diff --git a/README.md b/README.md index bc37d5fe6..34664689b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ -[English](./docs/README.md) | [Chinese (Simplified Han script)](./docs/README-ZH_CN.md) | [Chinese (Traditional Han script)](./docs/README-ZH_TW.md) | [Spanish](./docs/README-es.md) | [Italian](./docs/README-it.md) | [Japanese](./docs/README-ja.md) | [Romanian](./docs/README-ro.md) | [German](./docs/README-de.md) | [Greek](./docs/README-el.md) | [French](./docs/README-fr.md) +[Chinese (Simplified Han script)](./docs/README-ZH_CN.md) | [Chinese (Traditional Han script)](./docs/README-ZH_TW.md) | [English](./docs/README.md) | [French](./docs/README-fr.md) | [German](./docs/README-de.md) | [Greek](./docs/README-el.md) | [Italian](./docs/README-it.md) | [Japanese](./docs/README-ja.md) | [Romanian](./docs/README-ro.md) | [Spanish](./docs/README-es.md) Trilium Notes is a free and open-source, cross-platform hierarchical note taking application with focus on building large personal knowledge bases. diff --git a/docs/README.md b/docs/README.md index 968031c43..692c67272 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,7 +18,7 @@ -[English](../README.md) | [Chinese (Simplified Han script)](./README-ZH_CN.md) | [Chinese (Traditional Han script)](./README-ZH_TW.md) | [Spanish](./README-es.md) | [Italian](./README-it.md) | [Japanese](./README-ja.md) | [Romanian](./README-ro.md) | [German](./README-de.md) | [Greek](./README-el.md) | [French](./README-fr.md) +[Chinese (Simplified Han script)](./README-ZH_CN.md) | [Chinese (Traditional Han script)](./README-ZH_TW.md) | [English](../README.md) | [French](./README-fr.md) | [German](./README-de.md) | [Greek](./README-el.md) | [Italian](./README-it.md) | [Japanese](./README-ja.md) | [Romanian](./README-ro.md) | [Spanish](./README-es.md) Trilium Notes is a free and open-source, cross-platform hierarchical note taking application with focus on building large personal knowledge bases. diff --git a/scripts/translation/manage-readme.ts b/scripts/translation/manage-readme.ts index 69682d360..1b4358d5c 100644 --- a/scripts/translation/manage-readme.ts +++ b/scripts/translation/manage-readme.ts @@ -5,16 +5,6 @@ const scriptDir = __dirname; const rootDir = join(scriptDir, "../.."); const docsDir = join(rootDir, "docs"); -/** - * The base file is used by Weblate when generating new languages for the README file. - * The problem is that translated READMEs reside in `/docs/` while the main README is in `/`, which breaks all relative links. - * As such, we need to use a separate base file that is in `/docs` with the right relative paths. - * The README in the repo root remains the true base file, but it's a two-step process which requires the execution of this script. - */ -async function handleBaseFile() { - -} - async function getLanguageStats() { const cacheFile = join(scriptDir, ".language-stats.json"); @@ -47,8 +37,10 @@ async function getLanguageStats() { async function rewriteLanguageBar(readme: string) { // Filter languages by their availability. const languageStats = await getLanguageStats(); - const languagesWithCoverage = languageStats.results.filter(language => language.translated_percent > 75); - const languageLinks = languagesWithCoverage.map(language => `[${language.language.name}](./${language.filename})`) + const languagesWithCoverage: any[] = languageStats.results.filter(language => language.translated_percent > 75); + const languageLinks = languagesWithCoverage + .map(language => `[${language.language.name}](./${language.filename})`) + .toSorted((a, b) => a.localeCompare(b)); readme = readme.replace( /\r?\n.*$/m, @@ -62,6 +54,12 @@ function rewriteRelativeLinks(readme: string) { return readme; } +/** + * The base file is used by Weblate when generating new languages for the README file. + * The problem is that translated READMEs reside in `/docs/` while the main README is in `/`, which breaks all relative links. + * As such, we need to use a separate base file that is in `/docs` with the right relative paths. + * The README in the repo root remains the true base file, but it's a two-step process which requires the execution of this script. + */ async function main() { // Read the README at root level. const readmePath = join(rootDir, "README.md");