From 1a53a247abdb7e20d81bce5d73fb07405fe3452a Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Fri, 4 Aug 2023 20:24:13 +0000 Subject: [PATCH] Update translation submodule (#2023) * Update translation submodule * Fix translation generation error --- generate_translations.js | 8 ++++---- lemmy-translations | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/generate_translations.js b/generate_translations.js index ac3e987..f9cde87 100644 --- a/generate_translations.js +++ b/generate_translations.js @@ -8,12 +8,12 @@ fs.readdir(translationDir, (_err, files) => { const lang = filename.split(".")[0]; try { const json = JSON.parse( - fs.readFileSync(translationDir + filename, "utf8") + fs.readFileSync(translationDir + filename, "utf8"), ); let data = `export const ${lang} = {\n translation: {`; for (const key in json) { if (key in json) { - const value = json[key].replace(/"/g, '\\"'); + const value = json[key].replace(/"/g, '\\"').replace("\n", "\\n"); data += `\n ${key}: "${value}",`; } } @@ -67,14 +67,14 @@ ${optionKeys.map(key => `${indent}| "${key}"`).join("\n")}; export type I18nKeys = NoOptionI18nKeys | OptionI18nKeys; export type TTypedOptions =${Array.from( - optionMap.entries() + optionMap.entries(), ).reduce( (acc, [key, options]) => `${acc} TKey extends \"${key}\" ? ${ options.reduce((acc, cur) => acc + `${cur}: string | number; `, "{ ") + "}" } :\n${indent}`, - "" + "", )} (Record | string); export interface TFunctionTyped { diff --git a/lemmy-translations b/lemmy-translations index 713ceed..2263760 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 713ceed9c7ef84deaa222e68361e670e0763cd83 +Subproject commit 22637606f4a4455458e64cefe9f5ec33dccb6c52 -- 2.44.1