not-locale 0.0.21 → 0.0.24
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/index.js +24 -16
- package/package.json +2 -2
- package/src/controllers/common/index.js +1 -1
- package/src/controllers/common/nsLocale.js +147 -151
- package/src/exceptions.js +17 -0
- package/src/locales/en.json +4 -0
- package/src/locales/ru.json +4 -0
- package/src/logics/locale.js +21 -54
- package/src/routes/locale.js +51 -48
- package/src/routes/locale.manifest.js +39 -33
- package/src/routes/locale.ws.js +18 -15
package/index.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
const {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} = require(
|
|
2
|
+
getMiddleware,
|
|
3
|
+
fromJSON,
|
|
4
|
+
fromDir,
|
|
5
|
+
say,
|
|
6
|
+
sayForModule,
|
|
7
|
+
modulePhrase,
|
|
8
|
+
vocabulary,
|
|
9
|
+
OPTS,
|
|
10
|
+
} = require("./src/common/lib.js");
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
name: "not-locale",
|
|
14
|
+
paths: {
|
|
15
|
+
controllers: __dirname + "/src/controllers",
|
|
16
|
+
logics: __dirname + "/src/logics",
|
|
17
|
+
locales: __dirname + "/src/locales",
|
|
18
|
+
routes: __dirname + "/src/routes",
|
|
19
|
+
},
|
|
20
|
+
getMiddleware,
|
|
21
|
+
fromJSON,
|
|
22
|
+
fromDir,
|
|
23
|
+
say,
|
|
24
|
+
sayForModule,
|
|
25
|
+
modulePhrase,
|
|
26
|
+
vocabulary,
|
|
27
|
+
OPTS,
|
|
20
28
|
};
|
package/package.json
CHANGED
|
@@ -3,170 +3,166 @@
|
|
|
3
3
|
*
|
|
4
4
|
**/
|
|
5
5
|
|
|
6
|
-
const SECTION_ID =
|
|
6
|
+
const SECTION_ID = "locale";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
notCommon,
|
|
10
|
-
notLocale,
|
|
11
|
-
Frame
|
|
12
|
-
} from 'not-bulma';
|
|
8
|
+
import { notCommon, notLocale, Frame } from "not-bulma";
|
|
13
9
|
|
|
14
|
-
const {notTopMenu} = Frame;
|
|
10
|
+
const { notTopMenu } = Frame;
|
|
15
11
|
|
|
16
12
|
class nsLocale {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates network interface for this service
|
|
29
|
-
*/
|
|
30
|
-
interface(data) {
|
|
31
|
-
return this.app.getInterface('locale')(data);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves dictionary for current locale
|
|
36
|
-
* sets dictionary in notLocale object
|
|
37
|
-
*/
|
|
38
|
-
async update() {
|
|
39
|
-
try {
|
|
40
|
-
await this.updateAvailable();
|
|
41
|
-
let res = await this.interface({
|
|
42
|
-
locale: this.getCurrentLocale()
|
|
43
|
-
}).$get({});
|
|
44
|
-
if (res.status === 'ok' && res.result) {
|
|
45
|
-
notLocale.set(res.result);
|
|
46
|
-
} else {
|
|
47
|
-
this.scheduleUpdate();
|
|
48
|
-
}
|
|
49
|
-
} catch (e) {
|
|
50
|
-
notCommon.error(e);
|
|
51
|
-
this.scheduleUpdate();
|
|
13
|
+
constructor(app) {
|
|
14
|
+
this.app = app;
|
|
15
|
+
this.locales = [];
|
|
16
|
+
this.failures = 0;
|
|
17
|
+
this.app.on("wsClient:main:connected", this.update.bind(this));
|
|
18
|
+
notLocale.on("change", () => {
|
|
19
|
+
this.app.emit("locale");
|
|
20
|
+
});
|
|
52
21
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates network interface for this service
|
|
25
|
+
*/
|
|
26
|
+
interface(data) {
|
|
27
|
+
return this.app.getInterface("locale")(data);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves dictionary for current locale
|
|
32
|
+
* sets dictionary in notLocale object
|
|
33
|
+
*/
|
|
34
|
+
async update() {
|
|
35
|
+
try {
|
|
36
|
+
await this.updateAvailable();
|
|
37
|
+
let res = await this.interface({
|
|
38
|
+
locale: this.getCurrentLocale(),
|
|
39
|
+
}).$get({});
|
|
40
|
+
if (res.status === "ok" && res.result) {
|
|
41
|
+
notLocale.set(res.result);
|
|
42
|
+
} else {
|
|
43
|
+
this.scheduleUpdate();
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
notCommon.error(e);
|
|
47
|
+
this.scheduleUpdate();
|
|
48
|
+
}
|
|
61
49
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} catch (e) {
|
|
71
|
-
notCommon.error(e);
|
|
50
|
+
|
|
51
|
+
scheduleUpdate() {
|
|
52
|
+
this.failures++;
|
|
53
|
+
if (this.failures < 100) {
|
|
54
|
+
setTimeout(this.update.bind(this), 1000 * this.failures);
|
|
55
|
+
} else {
|
|
56
|
+
notCommon.error("Too many failures of locale loading");
|
|
57
|
+
}
|
|
72
58
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
}, 1000);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
createMenuItems(list) {
|
|
88
|
-
let items = list.map(this.createMenuItem.bind(this));
|
|
89
|
-
return items;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
createMenuItem(item) {
|
|
93
|
-
return {
|
|
94
|
-
id: `${SECTION_ID}.${item}`,
|
|
95
|
-
section: SECTION_ID,
|
|
96
|
-
title: item,
|
|
97
|
-
classes: ' is-clickable ',
|
|
98
|
-
action: this.changeLocale.bind(this, item)
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
changeLocale(locale) {
|
|
103
|
-
this.saveLocaleToStore(locale);
|
|
104
|
-
this.update();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @returns {string} code of current locale
|
|
109
|
-
**/
|
|
110
|
-
getCurrentLocale() {
|
|
111
|
-
let stored = this.restoreLocaleFromStore();
|
|
112
|
-
if (stored) {
|
|
113
|
-
if (this.locales.includes(stored)) {
|
|
114
|
-
return stored;
|
|
115
|
-
}
|
|
59
|
+
|
|
60
|
+
async updateAvailable() {
|
|
61
|
+
try {
|
|
62
|
+
let res = await this.interface({}).$available({});
|
|
63
|
+
if (res.status === "ok" && res.result) {
|
|
64
|
+
this.setAvailable(res.result);
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
notCommon.error(e);
|
|
68
|
+
}
|
|
116
69
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
70
|
+
|
|
71
|
+
updateUI(list) {
|
|
72
|
+
let menuItems = this.createMenuItems(list);
|
|
73
|
+
notTopMenu.updateSectionItems(SECTION_ID, () => {
|
|
74
|
+
return menuItems;
|
|
75
|
+
});
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
this.app.emit(`tag-${SECTION_ID}:update`, {
|
|
78
|
+
title: this.getCurrentLocale(),
|
|
79
|
+
});
|
|
80
|
+
}, 1000);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
createMenuItems(list) {
|
|
84
|
+
let items = list.map(this.createMenuItem.bind(this));
|
|
85
|
+
return items;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
createMenuItem(item) {
|
|
89
|
+
return {
|
|
90
|
+
id: `${SECTION_ID}.${item}`,
|
|
91
|
+
section: SECTION_ID,
|
|
92
|
+
title: item,
|
|
93
|
+
class: " is-clickable ",
|
|
94
|
+
action: this.changeLocale.bind(this, item),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
changeLocale(locale) {
|
|
99
|
+
this.saveLocaleToStore(locale);
|
|
100
|
+
this.update();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @returns {string} code of current locale
|
|
105
|
+
**/
|
|
106
|
+
getCurrentLocale() {
|
|
107
|
+
let stored = this.restoreLocaleFromStore();
|
|
108
|
+
if (stored) {
|
|
109
|
+
if (this.locales.includes(stored)) {
|
|
110
|
+
return stored;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return this.selectBest();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @returns {Promise<Array>} of locales objects {code, title}
|
|
118
|
+
**/
|
|
119
|
+
getAvailable() {
|
|
120
|
+
return this.interface().$available({});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
setAvailable(list) {
|
|
124
|
+
this.locales = list;
|
|
125
|
+
this.updateUI(list);
|
|
141
126
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
127
|
+
|
|
128
|
+
restoreLocaleFromStore() {
|
|
129
|
+
if (window.localStorage) {
|
|
130
|
+
try {
|
|
131
|
+
return window.localStorage.getItem("locale");
|
|
132
|
+
} catch (e) {
|
|
133
|
+
this.app.error(e);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
151
137
|
return false;
|
|
152
|
-
}
|
|
153
138
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
139
|
+
|
|
140
|
+
saveLocaleToStore(locale) {
|
|
141
|
+
if (window.localStorage) {
|
|
142
|
+
try {
|
|
143
|
+
return window.localStorage.setItem("locale", locale);
|
|
144
|
+
} catch (e) {
|
|
145
|
+
this.app.error(e);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
165
150
|
}
|
|
166
|
-
return this.app.getWorking('locale', this.app.getOptions('modules.locale.default', 'ru'));
|
|
167
|
-
}
|
|
168
151
|
|
|
152
|
+
selectBest() {
|
|
153
|
+
if (navigator.languages) {
|
|
154
|
+
let locale = navigator.languages.find((itm) => {
|
|
155
|
+
return this.locales.includes(itm);
|
|
156
|
+
});
|
|
157
|
+
if (locale) {
|
|
158
|
+
return locale;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return this.app.getWorking(
|
|
162
|
+
"locale",
|
|
163
|
+
this.app.getOptions("modules.locale.default", "ru")
|
|
164
|
+
);
|
|
165
|
+
}
|
|
169
166
|
}
|
|
170
167
|
|
|
171
|
-
|
|
172
168
|
export default nsLocale;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { notError } = require("not-error");
|
|
2
|
+
|
|
3
|
+
class LocaleExceptionGetError extends notError {
|
|
4
|
+
constructor(params = {}, cause) {
|
|
5
|
+
super(`not-locale:exception_logic_get`, params, cause);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports.LocaleExceptionGetError = LocaleExceptionGetError;
|
|
10
|
+
|
|
11
|
+
class LocaleExceptionAvailableError extends notError {
|
|
12
|
+
constructor(params = {}, cause) {
|
|
13
|
+
super(`not-locale:exception_logic_available`, params, cause);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports.LocaleExceptionAvailableError = LocaleExceptionAvailableError;
|
package/src/logics/locale.js
CHANGED
|
@@ -1,63 +1,30 @@
|
|
|
1
|
-
const
|
|
2
|
-
const Log = require('not-log')(module, 'locale:logics');
|
|
1
|
+
const notLocale = require("../common/lib.js");
|
|
3
2
|
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
LocaleExceptionGetError,
|
|
4
|
+
LocaleExceptionAvailableError,
|
|
5
|
+
} = require("../exceptions");
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const MODEL_NAME = 'Locale';
|
|
7
|
+
const MODEL_NAME = "Locale";
|
|
10
8
|
exports.thisLogicName = MODEL_NAME;
|
|
11
9
|
|
|
12
10
|
class LocaleLogic {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
}catch(err){
|
|
23
|
-
Log.error(err);
|
|
24
|
-
notNode.Application.report(
|
|
25
|
-
new notError(
|
|
26
|
-
`locale:logic.get`,
|
|
27
|
-
{locale},
|
|
28
|
-
err
|
|
29
|
-
)
|
|
30
|
-
);
|
|
31
|
-
return {
|
|
32
|
-
status: 'error',
|
|
33
|
-
error: err.message
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static async available() {
|
|
39
|
-
try{
|
|
40
|
-
let result = notLocale.available();
|
|
41
|
-
return {
|
|
42
|
-
status: 'ok',
|
|
43
|
-
result
|
|
44
|
-
};
|
|
45
|
-
}catch(err){
|
|
46
|
-
Log.error(err);
|
|
47
|
-
notNode.Application.report(
|
|
48
|
-
new notError(
|
|
49
|
-
`locale:logic.available`,
|
|
50
|
-
{},
|
|
51
|
-
err
|
|
52
|
-
)
|
|
53
|
-
);
|
|
54
|
-
return {
|
|
55
|
-
status: 'error',
|
|
56
|
-
error: err.message
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
11
|
+
static async get({ locale }) {
|
|
12
|
+
try {
|
|
13
|
+
let result = notLocale.get(locale);
|
|
14
|
+
return result;
|
|
15
|
+
} catch (err) {
|
|
16
|
+
throw new LocaleExceptionGetError({ locale }, err);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
60
19
|
|
|
20
|
+
static async available() {
|
|
21
|
+
try {
|
|
22
|
+
let result = notLocale.available();
|
|
23
|
+
return result;
|
|
24
|
+
} catch (err) {
|
|
25
|
+
throw new LocaleExceptionAvailableError({}, err);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
61
28
|
}
|
|
62
29
|
|
|
63
30
|
exports[MODEL_NAME] = LocaleLogic;
|
package/src/routes/locale.js
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
const Log = require(
|
|
2
|
-
const {notError} = require(
|
|
3
|
-
const notNode = require(
|
|
1
|
+
const Log = require("not-log")(module, "locale:route");
|
|
2
|
+
const { notError } = require("not-error");
|
|
3
|
+
const notNode = require("not-node");
|
|
4
4
|
|
|
5
|
-
async function get(req, res){
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
async function get(req, res) {
|
|
6
|
+
try {
|
|
7
|
+
let locale = req.params.locale;
|
|
8
|
+
let result = await notNode.Application.getLogic("Locale").get({
|
|
9
|
+
locale,
|
|
10
|
+
});
|
|
11
|
+
res.status(200).json(result);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
Log.error(err);
|
|
14
|
+
notNode.Application.report(
|
|
15
|
+
new notError(
|
|
16
|
+
`locale:route.get`,
|
|
17
|
+
{
|
|
18
|
+
locale: req.query.locale,
|
|
19
|
+
owner: req.user ? req.user._id : undefined,
|
|
20
|
+
ownerModel: "User",
|
|
21
|
+
},
|
|
22
|
+
err
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
res.status(500).json({
|
|
26
|
+
status: "error",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
async function available(req, res){
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
async function available(req, res) {
|
|
32
|
+
try {
|
|
33
|
+
let result = await notNode.Application.getLogic("Locale").available();
|
|
34
|
+
res.status(200).json(result);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
Log.error(err);
|
|
37
|
+
notNode.Application.report(
|
|
38
|
+
new notError(
|
|
39
|
+
`locale:route.available`,
|
|
40
|
+
{
|
|
41
|
+
owner: req.user ? req.user._id : undefined,
|
|
42
|
+
ownerModel: "User",
|
|
43
|
+
},
|
|
44
|
+
err
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
res.status(500).json({
|
|
48
|
+
status: "error",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
50
53
|
module.exports = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
get,
|
|
55
|
+
_get: get,
|
|
56
|
+
available,
|
|
57
|
+
_available: available,
|
|
55
58
|
};
|
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
const {error} = require(
|
|
1
|
+
const { error } = require("not-log")(module, "locale:route");
|
|
2
2
|
|
|
3
3
|
try {
|
|
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
|
-
|
|
4
|
+
module.exports = {
|
|
5
|
+
model: "locale",
|
|
6
|
+
url: "/api/:modelName",
|
|
7
|
+
fields: {},
|
|
8
|
+
actions: {
|
|
9
|
+
get: {
|
|
10
|
+
ws: true,
|
|
11
|
+
method: "GET",
|
|
12
|
+
isArray: false,
|
|
13
|
+
postFix: "/:actionName",
|
|
14
|
+
data: ["record"],
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
auth: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
auth: false,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
available: {
|
|
25
|
+
ws: true,
|
|
26
|
+
method: "GET",
|
|
27
|
+
isArray: false,
|
|
28
|
+
postFix: "/:actionName",
|
|
29
|
+
data: ["record"],
|
|
30
|
+
rules: [
|
|
31
|
+
{
|
|
32
|
+
auth: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
auth: false,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
35
41
|
} catch (e) {
|
|
36
|
-
|
|
42
|
+
error(e);
|
|
37
43
|
}
|
package/src/routes/locale.ws.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
const notNode = require(
|
|
1
|
+
const notNode = require("not-node");
|
|
2
2
|
|
|
3
|
-
async function get({data}){
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
async function get({ data }) {
|
|
4
|
+
return await notNode.Application.getLogic("Locale").get({
|
|
5
|
+
locale: data.locale,
|
|
6
|
+
});
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
async function available(){
|
|
9
|
-
|
|
10
|
-
return result;
|
|
9
|
+
async function available() {
|
|
10
|
+
return await notNode.Application.getLogic("Locale").available();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
module.exports = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
servers: {
|
|
15
|
+
//collection type
|
|
16
|
+
main: {
|
|
17
|
+
//collection name
|
|
18
|
+
request: {
|
|
19
|
+
//routes(end-points) type
|
|
20
|
+
get, //end-points
|
|
21
|
+
available,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
22
25
|
};
|