mirror of
https://github.com/zadam/trilium.git
synced 2026-02-01 12:09:20 +01:00
chore(readme): order languages alphabetically
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user