chore(readme): order languages alphabetically

This commit is contained in:
Elian Doran 2025-12-08 13:03:32 +02:00
parent ce5a775160
commit 3ee8eac635
No known key found for this signature in database
3 changed files with 12 additions and 14 deletions

View File

@ -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.

2
docs/README.md vendored
View File

@ -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.

View File

@ -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");