mirror of
https://github.com/documize/community.git
synced 2025-07-19 21:29:42 +02:00
Select language for server and per user
This commit is contained in:
parent
4494ace0a2
commit
e81cbad385
5 changed files with 18 additions and 16 deletions
|
@ -25,7 +25,6 @@ var localeMap map[string]map[string]string
|
||||||
// SupportedLocales returns array of locales.
|
// SupportedLocales returns array of locales.
|
||||||
func SupportedLocales() (locales []string) {
|
func SupportedLocales() (locales []string) {
|
||||||
locales = append(locales, "en-US")
|
locales = append(locales, "en-US")
|
||||||
locales = append(locales, "de-DE")
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
import { A } from '@ember/array';
|
||||||
import { empty, and } from '@ember/object/computed';
|
import { empty, and } from '@ember/object/computed';
|
||||||
import { isEmpty } from '@ember/utils';
|
import { isEmpty } from '@ember/utils';
|
||||||
import { set } from '@ember/object';
|
import { set } from '@ember/object';
|
||||||
|
@ -30,14 +31,14 @@ export default Component.extend(Notifier, {
|
||||||
hasTitleInputError: and('titleEmpty', 'titleError'),
|
hasTitleInputError: and('titleEmpty', 'titleError'),
|
||||||
hasMessageInputError: and('messageEmpty', 'messageError'),
|
hasMessageInputError: and('messageEmpty', 'messageError'),
|
||||||
hasConversionEndpointInputError: and('conversionEndpointEmpty', 'conversionEndpointError'),
|
hasConversionEndpointInputError: and('conversionEndpointEmpty', 'conversionEndpointError'),
|
||||||
locale: {},
|
locale: { name: '' },
|
||||||
locales: null,
|
locales: A([]),
|
||||||
|
|
||||||
init() {
|
init(...args) {
|
||||||
this._super(...arguments);
|
this._super(...args);
|
||||||
|
|
||||||
let l = this.get('appMeta.locales');
|
let l = this.get('appMeta.locales');
|
||||||
let t = [];
|
let t = A([]);
|
||||||
|
|
||||||
l.forEach((locale) => {
|
l.forEach((locale) => {
|
||||||
t.pushObject({ name: locale });
|
t.pushObject({ name: locale });
|
||||||
|
@ -51,7 +52,8 @@ export default Component.extend(Notifier, {
|
||||||
|
|
||||||
this.set('maxTags', this.get('model.general.maxTags'));
|
this.set('maxTags', this.get('model.general.maxTags'));
|
||||||
this.set('domain', this.get('model.general.domain'));
|
this.set('domain', this.get('model.general.domain'));
|
||||||
this.set('locale', { name: this.get('model.general.locale') });
|
|
||||||
|
this.set('locale', this.locales.findBy('name', this.get('model.general.locale')));
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
import { A } from '@ember/array';
|
||||||
import { empty } from '@ember/object/computed';
|
import { empty } from '@ember/object/computed';
|
||||||
import { computed, set } from '@ember/object';
|
import { computed, set } from '@ember/object';
|
||||||
import { isPresent, isEqual, isEmpty } from '@ember/utils';
|
import { isPresent, isEqual, isEmpty } from '@ember/utils';
|
||||||
|
@ -46,7 +47,7 @@ export default Component.extend(AuthProvider, {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
locale: {},
|
locale: { name: '' },
|
||||||
locales: null,
|
locales: null,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
@ -54,7 +55,7 @@ export default Component.extend(AuthProvider, {
|
||||||
this.password = { password: "", confirmation: "" };
|
this.password = { password: "", confirmation: "" };
|
||||||
|
|
||||||
let l = this.get('appMeta.locales');
|
let l = this.get('appMeta.locales');
|
||||||
let t = [];
|
let t = A([]);
|
||||||
|
|
||||||
l.forEach((locale) => {
|
l.forEach((locale) => {
|
||||||
t.pushObject( {name: locale} );
|
t.pushObject( {name: locale} );
|
||||||
|
@ -66,7 +67,7 @@ export default Component.extend(AuthProvider, {
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.set('locale', { name: this.get('model.locale') });
|
this.set('locale', this.locales.findBy('name', this.get('model.locale')));
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
{{#section/base-editor-inline document=document folder=folder page=page tip=(localize 'section_pdf') isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
|
{{#section/base-editor-inline document=document folder=folder page=page tip=(localize 'section_pdf') isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="new-space-name">{{localize 'pdf'}}</label>
|
<label>{{localize 'pdf'}}</label>
|
||||||
{{input type="text" class="form-control mousetrap" placeholder="click upload button below" value=pdfName readonly=true}}
|
{{input type="text" class="form-control mousetrap" placeholder="click upload button below" value=pdfName readonly=true}}
|
||||||
<small class="form-text text-muted">{{localize 'section_pdf_upload_explain'}}</small>
|
<small class="form-text text-muted">{{localize 'section_pdf_upload_explain'}}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="new-space-name">{{localize 'section_pdf_height'}}</label>
|
<label>{{localize 'section_pdf_height'}}</label>
|
||||||
{{input type="number" class="form-control mousetrap" placeholder="e.g. 700" value=pdfOption.height}}
|
{{input type="number" class="form-control mousetrap" placeholder="e.g. 700" value=pdfOption.height}}
|
||||||
<small class="form-text text-muted">{{localize 'section_pdf_height_explain'}}</small>
|
<small class="form-text text-muted">{{localize 'section_pdf_height_explain'}}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="new-space-name">{{localize 'section_pdf_start'}}</label>
|
<label>{{localize 'section_pdf_start'}}</label>
|
||||||
{{input type="number" class="form-control mousetrap" placeholder="e.g. 1" value=pdfOption.startPage}}
|
{{input type="number" class="form-control mousetrap" placeholder="e.g. 1" value=pdfOption.startPage}}
|
||||||
<small class="form-text text-muted">{{localize 'section_pdf_start_explain'}}</small>
|
<small class="form-text text-muted">{{localize 'section_pdf_start_explain'}}</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="new-space-name">{{localize 'section_pdf_sidebar'}}</label>
|
<label>{{localize 'section_pdf_sidebar'}}</label>
|
||||||
<select onchange={{action "onSetSidebar" value="target.value"}} class="form-control" role="button" tabindex="0">
|
<select onchange={{action "onSetSidebar" value="target.value"}} class="form-control" role="button" tabindex="0">
|
||||||
<option value="none" selected={{is-equal pdfOption.sidebar "none"}}>
|
<option value="none" selected={{is-equal pdfOption.sidebar "none"}}>
|
||||||
{{localize 'section_pdf_sidebar_none'}}
|
{{localize 'section_pdf_sidebar_none'}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue