mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-24 21:31:12 +00:00
Update translation submodule (#2023)
* Update translation submodule * Fix translation generation error
This commit is contained in:
parent
afafb777b4
commit
1a53a247ab
2 changed files with 5 additions and 5 deletions
|
@ -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<TKey extends OptionI18nKeys> =${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, unknown> | string);
|
||||
|
||||
export interface TFunctionTyped {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 713ceed9c7ef84deaa222e68361e670e0763cd83
|
||||
Subproject commit 22637606f4a4455458e64cefe9f5ec33dccb6c52
|
Loading…
Reference in a new issue