use parens for arrow funcs always
This commit is contained in:
@@ -5,10 +5,10 @@ const { keys } = require('./getTranslationKeys');
|
||||
|
||||
const errors = [];
|
||||
|
||||
locales.forEach(locale => {
|
||||
locales.forEach((locale) => {
|
||||
const dict = require(getLocalePath({ locale }));
|
||||
const keysFromDict = Object.keys(dict);
|
||||
keysFromDict.forEach(key => {
|
||||
keysFromDict.forEach((key) => {
|
||||
if (!keys.includes(key)) {
|
||||
errors.push(
|
||||
`"${key}" key not found in "${locale}" locale dict. Please run "npm run translation:generate" and commit changes.`
|
||||
|
||||
@@ -19,7 +19,7 @@ function sortDict(dict) {
|
||||
);
|
||||
}
|
||||
|
||||
locales.forEach(locale => {
|
||||
locales.forEach((locale) => {
|
||||
let currentDict = {};
|
||||
const pathToDict = getLocalePath({ locale });
|
||||
if (fs.existsSync(pathToDict)) {
|
||||
@@ -35,6 +35,6 @@ locales.forEach(locale => {
|
||||
fs.writeFileSync(pathToDict, `${JSON.stringify(currentDict, null, 2)}\n`);
|
||||
fs.writeFileSync(
|
||||
path.resolve(__dirname, `../app/utils/loadLocale.ts`),
|
||||
renderLoadLocale(locales.filter(locale => locale !== 'en'))
|
||||
renderLoadLocale(locales.filter((locale) => locale !== 'en'))
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ const enMessages = {};
|
||||
export async function loadLocale(locale: string): Promise<Record<string, string>> {
|
||||
${locales
|
||||
.map(
|
||||
locale => ` if (locale === '${locale}') {
|
||||
(locale) => ` if (locale === '${locale}') {
|
||||
return import(/* webpackChunkName: "${locale}" */ '../locales/${locale}.json').then((res) => res.default).catch(() => enMessages);
|
||||
}
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user