fix translation tasks for compatibility with latest version on formatjs

This commit is contained in:
Pavel Mineev
2021-01-12 13:39:26 -06:00
committed by Umputun
parent f332ab194d
commit 43935bbd38
4 changed files with 17 additions and 36 deletions
+5 -5
View File
@@ -102,8 +102,8 @@
"errors.2": "Failed to unmarshal incoming request.",
"errors.3": "You don't have permission for this operation.",
"errors.4": "Invalid comment data.",
"errors.5": "Comment cannot be found. Please refresh the page and try again.",
"errors.6": "Site cannot be found. Please refresh the page and try again.",
"errors.5": "Comment cannot be found. Please refresh the page and try again.",
"errors.6": "Site cannot be found. Please refresh the page and try again.",
"errors.7": "User has been blocked.",
"errors.8": "User has been blocked.",
"errors.9": "Comment changing failed. Please try again a bit later.",
@@ -150,11 +150,11 @@
"subscribeByRSS.thread": "Thread",
"subscribeByRSS.title": "RSS",
"toolbar.attach-image": "Attach the image, drag & drop or paste from clipboard",
"toolbar.bold": "Add bold text <cmd-b>",
"toolbar.bold": "Add bold text {shortcut}",
"toolbar.code": "Insert a code",
"toolbar.header": "Add header text",
"toolbar.italic": "Add italic text <cmd-i>",
"toolbar.link": "Add a link <cmd-k>",
"toolbar.italic": "Add italic text {shortcut}",
"toolbar.link": "Add a link {shortcut}",
"toolbar.ordered-list": "Add a numbered list",
"toolbar.quote": "Insert a quote",
"toolbar.unordered-list": "Add a bulleted list",
+9 -27
View File
@@ -4,49 +4,31 @@ const enMessages = {};
export async function loadLocale(locale: string): Promise<Record<string, string>> {
if (locale === 'ru') {
return import(/* webpackChunkName: "ru.locale" */ '../locales/ru.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "ru" */ '../locales/ru.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'de') {
return import(/* webpackChunkName: "de.locale" */ '../locales/de.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "de" */ '../locales/de.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'fi') {
return import(/* webpackChunkName: "fi.locale" */ '../locales/fi.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "fi" */ '../locales/fi.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'es') {
return import(/* webpackChunkName: "es.locale" */ '../locales/es.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "es" */ '../locales/es.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'zh') {
return import(/* webpackChunkName: "zh.locale" */ '../locales/zh.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "zh" */ '../locales/zh.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'tr') {
return import(/* webpackChunkName: "tr.locale" */ '../locales/tr.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "tr" */ '../locales/tr.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'bg') {
return import(/* webpackChunkName: "bg.locale" */ '../locales/bg.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "bg" */ '../locales/bg.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'ua') {
return import(/* webpackChunkName: "ua.locale" */ '../locales/ua.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "ua" */ '../locales/ua.json').then(res => res.default).catch(() => enMessages);
}
if (locale === 'pl') {
return import(/* webpackChunkName: "pl.locale" */ '../locales/pl.json')
.then(m => m.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "pl" */ '../locales/pl.json').then(res => res.default).catch(() => enMessages);
}
return enMessages;
+2 -1
View File
@@ -2,7 +2,8 @@ const defaultMessages = require('../extracted-messages/messages');
const keyMessagePairs = [];
const keys = [];
defaultMessages.forEach(({ id, defaultMessage }) => {
Object.entries(defaultMessages).forEach(([id, { defaultMessage }]) => {
keyMessagePairs.push([id, defaultMessage]);
keys.push(id);
});
+1 -3
View File
@@ -7,9 +7,7 @@ export async function loadLocale(locale: string): Promise<Record<string, string>
${locales
.map(
locale => ` if (locale === '${locale}') {
return import(/* webpackChunkName: "${locale}" */ '../locales/${locale}.json')
.then(res => res.default)
.catch(() => enMessages);
return import(/* webpackChunkName: "${locale}" */ '../locales/${locale}.json').then((res) => res.default).catch(() => enMessages);
}
`
)