diff --git a/gui/.eslintrc.js b/gui/.eslintrc.js index 134bf586..f3117e9b 100644 --- a/gui/.eslintrc.js +++ b/gui/.eslintrc.js @@ -24,7 +24,11 @@ module.exports = { "ember/no-get": "off", "ember/no-jquery": "off", "ember/no-mixins": "off", - "ember/no-actions-hash": "off" + "ember/no-actions-hash": "off", + "ember/require-computed-macros": "off", + "ember/use-ember-data-rfc-395-imports": "off", + "ember/avoid-leaking-state-in-ember-objects": "off", + "ember/require-return-from-computed": "off" }, overrides: [ // node files diff --git a/gui/app/helpers/localize.js b/gui/app/helpers/localize.js new file mode 100644 index 00000000..2a825a91 --- /dev/null +++ b/gui/app/helpers/localize.js @@ -0,0 +1,17 @@ +// Copyright 2022 Documize Inc. . All rights reserved. +// +// This software (Documize Community Edition) is licensed under +// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html +// +// https://www.documize.com + +import Helper from '@ember/component/helper'; +import { inject as service } from '@ember/service'; + +export default Helper.extend({ + i18n: service(), + + compute([key, ...rest]) { + return this.i18n.localize(key, ...rest); + } +}); diff --git a/gui/app/initializers/i18n.js b/gui/app/initializers/i18n.js new file mode 100644 index 00000000..cd9f5b59 --- /dev/null +++ b/gui/app/initializers/i18n.js @@ -0,0 +1,19 @@ +// Copyright 2022 Documize Inc. . All rights reserved. +// +// This software (Documize Community Edition) is licensed under +// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html +// +// https://www.documize.com + +export function initialize(application) { + application.inject('route', 'i18n', 'service:i18n'); + application.inject('controller', 'i18n', 'service:i18n'); + application.inject('component', 'i18n', 'service:i18n'); + application.inject('model', 'i18n', 'service:i18n'); +} + +export default { + name: 'i18n', + after: "application", + initialize: initialize +}; diff --git a/gui/app/models/user.js b/gui/app/models/user.js index 548a0aed..e1c53610 100644 --- a/gui/app/models/user.js +++ b/gui/app/models/user.js @@ -30,6 +30,7 @@ export default Model.extend({ theme: attr('string'), created: attr(), revised: attr(), + locale: attr('string', { defaultValue: "en-US" }), fullname: computed('firstname', 'lastname', function () { return `${this.get('firstname')} ${this.get('lastname')}`; diff --git a/gui/app/pods/auth/login/controller.js b/gui/app/pods/auth/login/controller.js index 50483d53..9599ad5d 100644 --- a/gui/app/pods/auth/login/controller.js +++ b/gui/app/pods/auth/login/controller.js @@ -76,5 +76,4 @@ export default Controller.extend(AuthProvider, { // } } } - }); diff --git a/gui/app/pods/folders/template.hbs b/gui/app/pods/folders/template.hbs index da6c224a..328a8366 100644 --- a/gui/app/pods/folders/template.hbs +++ b/gui/app/pods/folders/template.hbs @@ -23,7 +23,7 @@