Skip to content

Build your personal knowledge base with Trilium Notes

chore(readme): order languages alphabetically

Elian Doran3ee8eac635c8
diff --git a/README.md b/README.md
index bc37d5fe6f..34664689bb 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@
<!-- translate:off -->
<!-- LANGUAGE SWITCHER -->
-[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)
<!-- translate:on -->
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 968031c433..692c672728 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -18,7 +18,7 @@
<!-- translate:off -->
<!-- LANGUAGE SWITCHER -->
-[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)
<!-- translate:on -->
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 69682d3604..1b4358d5c6 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(
/<!-- LANGUAGE SWITCHER -->\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");