not-locale 0.0.27 → 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,36 +1,36 @@
|
|
|
1
|
-
import nsLocale from
|
|
1
|
+
import nsLocale from "./nsLocale";
|
|
2
2
|
|
|
3
3
|
const services = { nsLocale };
|
|
4
4
|
const manifest = {
|
|
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
|
-
|
|
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 };
|
|
@@ -15,6 +15,7 @@ class nsLocale {
|
|
|
15
15
|
this.locales = [];
|
|
16
16
|
this.failures = 0;
|
|
17
17
|
this.app.on("wsClient:main:connected", this.update.bind(this));
|
|
18
|
+
this.app.once("wsClient:main:disconnected", this.update.bind(this));
|
|
18
19
|
notLocale.on("change", () => {
|
|
19
20
|
this.app.emit("locale");
|
|
20
21
|
});
|
|
@@ -150,19 +151,24 @@ class nsLocale {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
selectBest() {
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
|
|
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
|
+
}
|
|
160
166
|
}
|
|
167
|
+
return this.app.getWorking(
|
|
168
|
+
"locale",
|
|
169
|
+
this.app.getOptions("modules.locale.default", defaultLocale)
|
|
170
|
+
);
|
|
161
171
|
}
|
|
162
|
-
return this.app.getWorking(
|
|
163
|
-
"locale",
|
|
164
|
-
this.app.getOptions("modules.locale.default", defaultLocale)
|
|
165
|
-
);
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
174
|
|
|
@@ -15,9 +15,13 @@ try {
|
|
|
15
15
|
rules: [
|
|
16
16
|
{
|
|
17
17
|
auth: true,
|
|
18
|
+
returnRoot: "result",
|
|
19
|
+
return: ["@*"],
|
|
18
20
|
},
|
|
19
21
|
{
|
|
20
22
|
auth: false,
|
|
23
|
+
returnRoot: "result",
|
|
24
|
+
return: ["@*"],
|
|
21
25
|
},
|
|
22
26
|
],
|
|
23
27
|
},
|
|
@@ -30,9 +34,13 @@ try {
|
|
|
30
34
|
rules: [
|
|
31
35
|
{
|
|
32
36
|
auth: true,
|
|
37
|
+
returnRoot: "result",
|
|
38
|
+
return: ["@*"],
|
|
33
39
|
},
|
|
34
40
|
{
|
|
35
41
|
auth: false,
|
|
42
|
+
returnRoot: "result",
|
|
43
|
+
return: ["@*"],
|
|
36
44
|
},
|
|
37
45
|
],
|
|
38
46
|
},
|