mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 21:47:10 -04:00
add: use user preferred lang for user form, and allow selecting
This commit is contained in:
parent
d4c5310d65
commit
ec130d4480
4 changed files with 51 additions and 1 deletions
|
@ -125,7 +125,7 @@ seriousm:emoji-continued@1.4.0
|
|||
service-configuration@1.0.5
|
||||
session@1.1.1
|
||||
sha@1.0.4
|
||||
softwarerero:accounts-t9n@1.1.6
|
||||
softwarerero:accounts-t9n@1.1.7
|
||||
spacebars@1.0.7
|
||||
spacebars-compiler@1.0.7
|
||||
srp@1.0.4
|
||||
|
|
|
@ -13,6 +13,13 @@ template(name="userFormsLayout")
|
|||
h1.at-form-landing-logo
|
||||
img(src="{{pathFor '/wekan-logo.png'}}" alt="Wekan")
|
||||
+Template.dynamic(template=content)
|
||||
div.at-form-lang
|
||||
select.select-lang.js-userform-set-language
|
||||
each languages
|
||||
if isCurrentLanguage
|
||||
option(value="{{tag}}" selected="selected") {{name}}
|
||||
else
|
||||
option(value="{{tag}}") {{name}}
|
||||
|
||||
template(name="defaultLayout")
|
||||
+header
|
||||
|
|
|
@ -2,10 +2,43 @@ Meteor.subscribe('boards');
|
|||
|
||||
BlazeLayout.setRoot('body');
|
||||
|
||||
const i18nTagToT9n = (i18nTag) => {
|
||||
// t9n/i18n tags are same now, see: https://github.com/softwarerero/meteor-accounts-t9n/pull/129
|
||||
// but we keep this conversion function here, to be aware that that they are different system.
|
||||
return i18nTag;
|
||||
};
|
||||
|
||||
Template.userFormsLayout.onRendered(() => {
|
||||
const i18nTag = navigator.language;
|
||||
if (i18nTag) {
|
||||
T9n.setLanguage(i18nTagToT9n(i18nTag));
|
||||
}
|
||||
EscapeActions.executeAll();
|
||||
});
|
||||
|
||||
Template.userFormsLayout.helpers({
|
||||
languages() {
|
||||
return _.map(TAPi18n.getLanguages(), (lang, tag) => {
|
||||
const name = lang.name;
|
||||
return { tag, name };
|
||||
});
|
||||
},
|
||||
|
||||
isCurrentLanguage() {
|
||||
const t9nTag = i18nTagToT9n(this.tag);
|
||||
const curLang = T9n.getLanguage() || 'en';
|
||||
return t9nTag === curLang;
|
||||
},
|
||||
});
|
||||
|
||||
Template.userFormsLayout.events({
|
||||
'change .js-userform-set-language'(evt) {
|
||||
const i18nTag = $(evt.currentTarget).val();
|
||||
T9n.setLanguage(i18nTagToT9n(i18nTag));
|
||||
evt.preventDefault();
|
||||
},
|
||||
});
|
||||
|
||||
Template.defaultLayout.events({
|
||||
'click .js-close-modal': () => {
|
||||
Modal.close();
|
||||
|
|
|
@ -45,3 +45,13 @@
|
|||
.at-signUp,
|
||||
.at-signIn
|
||||
font-weight: bold
|
||||
|
||||
.at-form-lang
|
||||
margin: auto
|
||||
width: 275px
|
||||
padding: 25px
|
||||
padding-bottom: 10px
|
||||
|
||||
.select-lang
|
||||
width: 275px
|
||||
font-size: 1.0em
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue