not-locale 0.0.26 → 0.0.28

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.26",
3
+ "version": "0.0.28",
4
4
  "description": "not-* family module for localization in not- environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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,17 +151,18 @@ class nsLocale {
150
151
  }
151
152
 
152
153
  selectBest() {
154
+ let defaultLocale = "ru";
153
155
  if (navigator.languages) {
154
- let locale = navigator.languages.find((itm) => {
156
+ const navigatorLocale = navigator.languages.find((itm) => {
155
157
  return this.locales.includes(itm);
156
158
  });
157
- if (locale) {
158
- return locale;
159
+ if (navigatorLocale) {
160
+ defaultLocale = navigatorLocale;
159
161
  }
160
162
  }
161
163
  return this.app.getWorking(
162
164
  "locale",
163
- this.app.getOptions("modules.locale.default", "ru")
165
+ this.app.getOptions("modules.locale.default", defaultLocale)
164
166
  );
165
167
  }
166
168
  }
@@ -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
  },