not-locale 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-locale",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "not-* family module for localization in not- environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,36 +1,36 @@
1
- import nsLocale from './nsLocale';
1
+ import nsLocale from "./nsLocale";
2
2
 
3
3
  const services = { nsLocale };
4
4
  const manifest = {
5
- modules:{
6
- locale:{
7
- default: 'ru'
8
- }
9
- },
10
- menu:{
11
- top:{
12
- sections:[
13
- {
14
- id: 'locale',
15
- title: '',
16
- icon: {
17
- font: 'language',
18
- size: 'medium',
19
- svg: '',
20
- src: '',
21
- },
22
- tag: {
23
- padding: 'small',
24
- bold: true,
25
- color: 'success',
26
- title: ''
27
- },
28
- showOnTouch: true,
29
- place: 'end'
30
- }
31
- ]
32
- }
33
- }
5
+ modules: {
6
+ locale: {
7
+ default: "ru",
8
+ },
9
+ },
10
+ menu: {
11
+ top: {
12
+ sections: [
13
+ {
14
+ id: "locale",
15
+ title: "",
16
+ icon: {
17
+ font: "language",
18
+ size: "medium",
19
+ svg: "",
20
+ src: "",
21
+ },
22
+ tag: {
23
+ padding: "small",
24
+ bold: true,
25
+ color: "success",
26
+ title: "",
27
+ },
28
+ showOnTouch: true,
29
+ place: "end",
30
+ },
31
+ ],
32
+ },
33
+ },
34
34
  };
35
35
 
36
- export { services, manifest};
36
+ export { services, manifest };
@@ -151,19 +151,24 @@ class nsLocale {
151
151
  }
152
152
 
153
153
  selectBest() {
154
- let defaultLocale = "ru";
155
- if (navigator.languages) {
156
- const navigatorLocale = navigator.languages.find((itm) => {
157
- return this.locales.includes(itm);
158
- });
159
- if (navigatorLocale) {
160
- defaultLocale = navigatorLocale;
154
+ const onlyOneEnabled = this.app.getOptions("modules.locale.only");
155
+ if (onlyOneEnabled) {
156
+ return this.app.getWorking("locale", onlyOneEnabled);
157
+ } else {
158
+ let defaultLocale = "ru";
159
+ if (navigator.languages) {
160
+ const navigatorLocale = navigator.languages.find((itm) => {
161
+ return this.locales.includes(itm);
162
+ });
163
+ if (navigatorLocale) {
164
+ defaultLocale = navigatorLocale;
165
+ }
161
166
  }
167
+ return this.app.getWorking(
168
+ "locale",
169
+ this.app.getOptions("modules.locale.default", defaultLocale)
170
+ );
162
171
  }
163
- return this.app.getWorking(
164
- "locale",
165
- this.app.getOptions("modules.locale.default", defaultLocale)
166
- );
167
172
  }
168
173
  }
169
174