Total Complexity | 13 |
Complexity/F | 1.3 |
Lines of Code | 87 |
Function Count | 10 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 1 |
1 | /*jslint |
||
10 | var Lang = {}; |
||
11 | |||
12 | Lang.init = function () { |
||
13 | 'use strict'; |
||
14 | |||
15 | i18next |
||
16 | .use(i18nextXHRBackend) |
||
17 | .use(i18nextBrowserLanguageDetector) |
||
18 | .init({ |
||
19 | debug: false, |
||
20 | load: 'all', |
||
21 | resGetPath: 'lang/{{lng}}/{{ns}}.json', |
||
22 | fallbackLng: "en", |
||
23 | backend: { |
||
24 | loadPath: 'lang/{{lng}}/{{ns}}.json' |
||
25 | }, |
||
26 | detection: { |
||
27 | order: ['querystring', 'cookie', 'localStorage', 'navigator'], |
||
28 | lookupQuerystring: 'lang', |
||
29 | lookupCookie: 'i18next', |
||
30 | lookupLocalStorage: 'i18nextLng', |
||
31 | caches: ['localStorage', 'cookie'] |
||
32 | } |
||
33 | }, function (err) { |
||
34 | if (!err) { |
||
35 | jqueryI18next.init(i18next, $); |
||
36 | $(document).localize(); |
||
37 | } |
||
38 | }); |
||
39 | }; |
||
40 | |||
41 | Lang.set = function (lang) { |
||
42 | 'use strict'; |
||
43 | |||
44 | i18next.changeLanguage(lang, function (err) { |
||
45 | if (!err) { |
||
46 | $(document).localize(); |
||
47 | } |
||
48 | }); |
||
49 | }; |
||
50 | |||
51 | Lang.setEN = function () { |
||
52 | 'use strict'; |
||
53 | |||
54 | trackAction("langEN"); |
||
55 | this.set("en"); |
||
56 | }; |
||
57 | |||
58 | |||
59 | Lang.setDE = function () { |
||
60 | 'use strict'; |
||
61 | |||
62 | trackAction("langDE"); |
||
63 | this.set("de"); |
||
64 | }; |
||
65 | |||
66 | Lang.setNL = function () { |
||
67 | 'use strict'; |
||
68 | |||
69 | trackAction("langNL"); |
||
70 | this.set("nl"); |
||
71 | }; |
||
72 | |||
73 | Lang.setRO = function () { |
||
74 | 'use strict'; |
||
75 | |||
76 | trackAction("langRO"); |
||
77 | this.set("ro"); |
||
78 | }; |
||
79 | |||
80 | Lang.setPL = function () { |
||
81 | 'use strict'; |
||
82 | |||
83 | trackAction("langPL"); |
||
84 | this.set("pl"); |
||
85 | }; |
||
86 | |||
87 | |||
88 | function mytrans(key) { |
||
89 | 'use strict'; |
||
90 | |||
91 | if (typeof $.t === "function") { |
||
92 | return $.t(key); |
||
93 | } |
||
94 | |||
95 | return key; |
||
96 | } |
||
97 |