Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const config = {
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale,
locales: ["zh-Hans", "en", "ru"],
locales: ["zh-Hans", "en", "ru", "fr", "ar", "id", "tr", "ko", "uk", "nl", "fa", "bn", "hy"],
localeConfigs: {
"zh-Hans": {
label: "简体中文",
Expand All @@ -94,6 +94,56 @@ const config = {
direction: "ltr",
htmlLang: "ru",
},
fr: {
label: "Français",
direction: "ltr",
htmlLang: "fr",
},
ar: {
label: "العربية",
direction: "rtl",
htmlLang: "ar",
},
id: {
label: "Bahasa Indonesia",
direction: "ltr",
htmlLang: "id",
},
tr: {
label: "Türkçe",
direction: "ltr",
htmlLang: "tr",
},
ko: {
label: "한국어",
direction: "ltr",
htmlLang: "ko",
},
uk: {
label: "Українська",
direction: "ltr",
htmlLang: "uk",
},
nl: {
label: "Nederlands",
direction: "ltr",
htmlLang: "nl",
},
fa: {
label: "فارسی",
direction: "rtl",
htmlLang: "fa",
},
bn: {
label: "বাংলা",
direction: "ltr",
htmlLang: "bn",
},
hy: {
label: "Հայերեն",
direction: "ltr",
htmlLang: "hy",
},
},
},

Expand Down
4 changes: 4 additions & 0 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -947,5 +947,9 @@
},
"home.nav.theme": {
"message": "Toggle theme"
},
"home.hero.en": {
"message": "Superpowers for your browser.",
"description": "Hero subtitle tagline on homepage"
}
}
4 changes: 4 additions & 0 deletions i18n/ru/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -947,5 +947,9 @@
},
"home.nav.theme": {
"message": "Сменить тему"
},
"home.hero.en": {
"message": "Суперспособности для вашего браузера.",
"description": "Hero subtitle tagline on homepage"
}
}
4 changes: 4 additions & 0 deletions i18n/zh-Hans/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -937,5 +937,9 @@
"uninstall.feature.alert.button": {
"message": "前往GitHub提出功能建议",
"description": "Feature alert button text"
},
"home.hero.en": {
"message": "为您的浏览器赋予超能力。",
"description": "Hero subtitle tagline on homepage"
}
}
8 changes: 5 additions & 3 deletions scripts/check-frontmatter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import { readFileSync, existsSync, readdirSync, statSync } from "node:fs";
import { join, relative, sep, basename } from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = new URL("..", import.meta.url).pathname;
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const I18N_DIR = join(ROOT, "i18n");
const DOCS_PLUGIN_PATH = "docusaurus-plugin-content-docs/current";
const DOC_DIRS = [
Expand Down Expand Up @@ -41,10 +42,11 @@ function listDocs(dir) {
}

function parseFrontmatter(text) {
const match = /^---\n([\s\S]*?)\n---\n?/.exec(text);
// CRLF-tolerant: git may check files out with CRLF on Windows.
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(text);
if (!match) return { fm: {}, body: text };
const fm = {};
for (const line of match[1].split("\n")) {
for (const line of match[1].split(/\r?\n/)) {
const m = /^([\w-]+):\s*(.*)$/.exec(line);
if (m) fm[m[1]] = m[2].trim();
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/check-i18n-fallbacks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
import { extname, join, relative, sep } from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = new URL("..", import.meta.url).pathname;
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const BUILD_DIR = join(ROOT, "build");
const I18N_DIR = join(ROOT, "i18n");
const DOCS_PLUGIN_PATH = "docusaurus-plugin-content-docs/current";
Expand Down
3 changes: 2 additions & 1 deletion scripts/check-i18n-parity.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

import { readFileSync, existsSync, readdirSync, statSync } from "node:fs";
import { join, relative, sep } from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = new URL("..", import.meta.url).pathname;
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const DEFAULT_DIR = join(ROOT, "docs");
const I18N_DIR = join(ROOT, "i18n");
const DOCS_PLUGIN_PATH = "docusaurus-plugin-content-docs/current";
Expand Down
10 changes: 8 additions & 2 deletions scripts/check-url-inventory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import { readdirSync, statSync, readFileSync, writeFileSync, existsSync } from "node:fs";
import { join, relative, sep } from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = new URL("..", import.meta.url).pathname;
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const BUILD_DIR = join(ROOT, "build");
const BASELINE_FILE = join(ROOT, "scripts", "url-inventory.txt");
const PAGE_FILES = new Set(["index.html", "404.html", "opensearch.xml"]);
Expand Down Expand Up @@ -54,7 +55,12 @@ function main() {
process.exit(1);
}

const baseline = readFileSync(BASELINE_FILE, "utf8").split("\n").filter(Boolean).sort();
// CRLF-tolerant: git may check the baseline out with CRLF on Windows.
const baseline = readFileSync(BASELINE_FILE, "utf8")
.split(/\r?\n/)
.map((l) => l.replace(/\r$/, ""))
.filter(Boolean)
.sort();
const baselineSet = new Set(baseline);
const currentSet = new Set(routes);

Expand Down
5 changes: 4 additions & 1 deletion scripts/fetch-landing-stats.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@

import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
import { join, dirname, relative } from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = new URL("..", import.meta.url).pathname;
// fileURLToPath (not .pathname) so ROOT is a valid Windows path too —
// URL.pathname leaves a leading slash before the drive letter ("C:\C:\...").
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const OUT_FILE = join(ROOT, "src", "data", "landing-stats.json");

// Repos whose contributor lists get aggregated (deduped) into one number/list.
Expand Down
Loading