mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
Initial i18n experiment
This commit is contained in:
parent
32a9528e6d
commit
245c538990
12 changed files with 103 additions and 38 deletions
33
gui/app/services/i18n.js
Normal file
33
gui/app/services/i18n.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2022 Documize Inc. <legal@documize.com>. 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 Service, { inject as service } from '@ember/service';
|
||||
import $ from 'jquery';
|
||||
|
||||
export default Service.extend({
|
||||
langs: { enUS: [] },
|
||||
locales: [],
|
||||
session: service(),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
$.getJSON("/i18n/en-US.json", (data) => {
|
||||
this.langs.enUS = data;
|
||||
});
|
||||
},
|
||||
|
||||
localize(key) {
|
||||
console.log(this.session.locale);
|
||||
|
||||
switch(this.session.locale) {
|
||||
case "fr-FR":
|
||||
return "unsupported";
|
||||
default:
|
||||
return this.langs.enUS[key];
|
||||
}
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue