@adminforth/i18n 1.6.8 → 1.7.0
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/dist/index.js +4 -2
- package/index.ts +5 -2
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import path from 'path';
|
|
|
14
14
|
import fs from 'fs-extra';
|
|
15
15
|
import chokidar from 'chokidar';
|
|
16
16
|
import { AsyncQueue } from '@sapphire/async-queue';
|
|
17
|
+
import getFlagEmoji from 'country-flag-svg';
|
|
17
18
|
const processFrontendMessagesQueue = new AsyncQueue();
|
|
18
19
|
const SLAVIC_PLURAL_EXAMPLES = {
|
|
19
20
|
uk: 'яблук | Яблуко | Яблука | Яблук', // zero | singular | 2-4 | 5+
|
|
@@ -788,14 +789,15 @@ export default class I18nPlugin extends AdminForthPlugin {
|
|
|
788
789
|
}
|
|
789
790
|
languagesList() {
|
|
790
791
|
return __awaiter(this, void 0, void 0, function* () {
|
|
791
|
-
return this.options.supportedLanguages.map((lang) => {
|
|
792
|
+
return Promise.all(this.options.supportedLanguages.map((lang) => __awaiter(this, void 0, void 0, function* () {
|
|
792
793
|
return {
|
|
793
794
|
code: lang,
|
|
794
795
|
nameOnNative: iso6391.getNativeName(getPrimaryLanguageCode(lang)),
|
|
795
796
|
nameEnglish: iso6391.getName(getPrimaryLanguageCode(lang)),
|
|
796
797
|
emojiFlag: getCountryCodeFromLangCode(lang).toUpperCase().replace(/./g, char => String.fromCodePoint(char.charCodeAt(0) + 127397)),
|
|
798
|
+
svgFlagB64: yield getFlagEmoji.default(getCountryCodeFromLangCode(lang)),
|
|
797
799
|
};
|
|
798
|
-
});
|
|
800
|
+
})));
|
|
799
801
|
});
|
|
800
802
|
}
|
|
801
803
|
feedCategoryTranslations(messages, category) {
|
package/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import path from 'path';
|
|
|
7
7
|
import fs from 'fs-extra';
|
|
8
8
|
import chokidar from 'chokidar';
|
|
9
9
|
import { AsyncQueue } from '@sapphire/async-queue';
|
|
10
|
+
import getFlagEmoji from 'country-flag-svg';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
const processFrontendMessagesQueue = new AsyncQueue();
|
|
@@ -922,15 +923,17 @@ export default class I18nPlugin extends AdminForthPlugin {
|
|
|
922
923
|
nameOnNative: string;
|
|
923
924
|
nameEnglish: string;
|
|
924
925
|
emojiFlag: string;
|
|
926
|
+
svgFlagB64: string;
|
|
925
927
|
}[]> {
|
|
926
|
-
return this.options.supportedLanguages.map((lang) => {
|
|
928
|
+
return Promise.all(this.options.supportedLanguages.map(async (lang) => {
|
|
927
929
|
return {
|
|
928
930
|
code: lang,
|
|
929
931
|
nameOnNative: iso6391.getNativeName(getPrimaryLanguageCode(lang)),
|
|
930
932
|
nameEnglish: iso6391.getName(getPrimaryLanguageCode(lang)),
|
|
931
933
|
emojiFlag: getCountryCodeFromLangCode(lang).toUpperCase().replace(/./g, char => String.fromCodePoint(char.charCodeAt(0) + 127397)),
|
|
934
|
+
svgFlagB64: await (getFlagEmoji as any).default(getCountryCodeFromLangCode(lang)),
|
|
932
935
|
};
|
|
933
|
-
});
|
|
936
|
+
}));
|
|
934
937
|
}
|
|
935
938
|
|
|
936
939
|
async feedCategoryTranslations(messages: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/i18n",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@aws-sdk/client-ses": "^3.654.0",
|
|
32
32
|
"@sapphire/async-queue": "^1.5.5",
|
|
33
33
|
"chokidar": "^4.0.1",
|
|
34
|
+
"country-flag-svg": "^1.0.19",
|
|
34
35
|
"fs-extra": "^11.3.2",
|
|
35
36
|
"iso-3166": "^4.3.0",
|
|
36
37
|
"iso-639-1": "^3.1.3"
|