-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
50 lines (42 loc) · 1.21 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Aurelia } from "aurelia-framework";
import { TCustomAttribute } from "aurelia-i18n";
import "bootstrap";
import Backend from "i18next-xhr-backend";
import moment from "moment";
import { parse } from "yamljs";
import environment from "./environment";
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.feature('resources');
aurelia.use.developmentLogging(environment.debug ? 'debug' : 'warn')
.plugin("aurelia-i18n", i18n => {
const aliases = ["t", "i18n"];
TCustomAttribute.configureAliases(aliases);
i18n.i18next.use(Backend);
i18n.i18next.on("languageChanged", lng => {
moment.locale(lng);
});
return i18n.setup({
backend: {
// loadPath: "./locales/{{lng}}/{{ns}}.json"
loadPath: "./locales/{{lng}}/{{ns}}.yaml",
parse
},
attributes: aliases,
lng: "en",
ns: ["translation"],
defaultNS: "translation",
fallbackLng: "fr",
interpolation: {
escapeValue: false
},
debug: false
})
})
.feature("resources");
if (environment.testing) {
aurelia.use.plugin('aurelia-testing');
}
return aurelia.start().then(() => aurelia.setRoot());
}