@nimpl/i18n 3.0.0 → 3.0.1
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/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/configuration/getConfig.js +3 -3
- package/dist/lib/loadI18nData.js +8 -1
- package/package.json +6 -6
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023
|
|
3
|
+
Copyright (c) 2023 Alex Savelyev <dev@alexdln.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ This library is an attempt to create a highly optimized solution exclusively usi
|
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
|
-
Support for loading translations during page rendering (
|
|
17
|
+
Support for loading translations during page rendering (_instead of the application build step_), allowing for up-to-date translations with ISR or SSR;
|
|
18
18
|
|
|
19
|
-
Support for revalidation logic, i.e. you can specify how often translations should be updated (
|
|
19
|
+
Support for revalidation logic, i.e. you can specify how often translations should be updated (_or that they should not be updated at all_);
|
|
20
20
|
|
|
21
21
|
Optimized caching system - not a single extra request will be sent, even with parallel building (which is now enabled by default);
|
|
22
22
|
|
|
@@ -46,4 +46,4 @@ Create tasks with wishes, ideas, difficulties, etc. All of them will definitely
|
|
|
46
46
|
|
|
47
47
|
## License
|
|
48
48
|
|
|
49
|
-
[MIT](https://github.com/
|
|
49
|
+
[MIT](https://github.com/alexdln/nimpl-i18n/blob/main/LICENSE)
|
|
@@ -45,13 +45,13 @@ const getConfig = async () => {
|
|
|
45
45
|
}
|
|
46
46
|
const { load, getLanguage, languages } = clientConfig;
|
|
47
47
|
if (!load) {
|
|
48
|
-
throw new Error(`Can't find "load" method in configuration file - https://github.com/
|
|
48
|
+
throw new Error(`Can't find "load" method in configuration file - https://github.com/alexdln/nimpl-i18n#configuration`);
|
|
49
49
|
}
|
|
50
50
|
if (!languages) {
|
|
51
|
-
throw new Error(`Can't find "languages" list in configuration file - https://github.com/
|
|
51
|
+
throw new Error(`Can't find "languages" list in configuration file - https://github.com/alexdln/nimpl-i18n#configuration`);
|
|
52
52
|
}
|
|
53
53
|
if (!getLanguage) {
|
|
54
|
-
throw new Error(`Can't find "getLanguage" method in configuration file - https://github.com/
|
|
54
|
+
throw new Error(`Can't find "getLanguage" method in configuration file - https://github.com/alexdln/nimpl-i18n#configuration`);
|
|
55
55
|
}
|
|
56
56
|
return clientConfig;
|
|
57
57
|
};
|
package/dist/lib/loadI18nData.js
CHANGED
|
@@ -8,7 +8,14 @@ const get_pathname_1 = require("@nimpl/getters/get-pathname");
|
|
|
8
8
|
const get_params_1 = require("@nimpl/getters/get-params");
|
|
9
9
|
const loadI18nData = async () => {
|
|
10
10
|
const config = await (0, getConfig_1.default)();
|
|
11
|
-
const language = await config.getLanguage({
|
|
11
|
+
const language = await config.getLanguage({
|
|
12
|
+
get pathname() {
|
|
13
|
+
return (0, get_pathname_1.getPathname)();
|
|
14
|
+
},
|
|
15
|
+
get params() {
|
|
16
|
+
return (0, get_params_1.getParams)();
|
|
17
|
+
},
|
|
18
|
+
});
|
|
12
19
|
if (!language || !config.languages.includes(language)) {
|
|
13
20
|
throw new Error(`Can\' load data for language "${language}", valid languages are: ${config.languages.join(", ")}`);
|
|
14
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimpl/i18n",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "i18n library for working with translations in server and client components",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./ClientTranslation": {
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
],
|
|
49
49
|
"repository": {
|
|
50
50
|
"type": "git",
|
|
51
|
-
"url": "git://github.com/
|
|
51
|
+
"url": "git://github.com/alexdln/nimpl-i18n.git"
|
|
52
52
|
},
|
|
53
53
|
"author": {
|
|
54
|
-
"name": "Savelyev
|
|
55
|
-
"email": "
|
|
56
|
-
"url": "https://github.com/
|
|
54
|
+
"name": "Alex Savelyev",
|
|
55
|
+
"email": "dev@alexdln.com",
|
|
56
|
+
"url": "https://github.com/alexdln/"
|
|
57
57
|
},
|
|
58
58
|
"license": "MIT",
|
|
59
59
|
"devDependencies": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"react": ">= 19.1.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@nimpl/getters": "2.
|
|
71
|
+
"@nimpl/getters": "2.2.1",
|
|
72
72
|
"html-entities": "2.4.0",
|
|
73
73
|
"object-path": "0.11.8"
|
|
74
74
|
}
|