Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix: reorder recognition language shortcuts

Ruben Lütke0d45e2788833
diff --git a/jarvis/ui/web/frontend/src/components/ui/language-select.tsx b/jarvis/ui/web/frontend/src/components/ui/language-select.tsx
index 6ed2b55034..4db94dc072 100644
--- a/jarvis/ui/web/frontend/src/components/ui/language-select.tsx
+++ b/jarvis/ui/web/frontend/src/components/ui/language-select.tsx
@@ -30,12 +30,11 @@ export interface LanguageSelectProps {
* someone choose one had a native `<select>`, where the list arrives as an
* unstyled operating-system widget with no search — so finding Japanese meant
* scrolling past ninety entries, and the first screenful was Afrikaans,
- * Albanian, Amharic, Armenian. The shortlist is ordered by speakers worldwide
- * with the user's own interface language pulled to the front, so it is about
- * the person holding the app rather than a preference written into the source
- * (§3). Nothing is hidden: every language is still in the list below it, and
- * typing searches the translated name, the language's own name, the English
- * name, and the code.
+ * Albanian, Amharic, Armenian. The shortlist has a stable curated order and
+ * appends the user's interface language or saved choice when necessary.
+ * Nothing is hidden: every language is still in the list below it, and typing
+ * searches the translated name, the language's own name, the English name, and
+ * the code.
*/
export function LanguageSelect({
value,
diff --git a/jarvis/ui/web/frontend/src/lib/languageNames.ts b/jarvis/ui/web/frontend/src/lib/languageNames.ts
index e3f0e2554c..9091070b10 100644
--- a/jarvis/ui/web/frontend/src/lib/languageNames.ts
+++ b/jarvis/ui/web/frontend/src/lib/languageNames.ts
@@ -43,32 +43,29 @@ const FALLBACK_NAMES: Readonly<Record<string, string>> = {
};
/**
- * The languages most people on earth speak, most-spoken first.
+ * Curated order for the short language band shown above the complete list.
*
- * Ordered by total speakers worldwide — an outside fact about the planet, not
- * about whoever happens to maintain this repo (§3: the maintainer's own
- * languages are never the baseline). It exists because scrolling an
- * alphabetical ~100-row list past Afrikaans, Albanian, Amharic and Armenian to
- * reach English is a worse first screen than showing the handful of entries a
- * random downloader is most likely to want.
- *
- * It only ever REORDERS: every code the backend serves stays reachable in the
- * full list below, and the user's own interface language is put ahead of this
- * ranking at build time, so a Hungarian UI leads with Hungarian.
+ * The product's three interface languages lead, followed by Chinese and other
+ * frequently selected European languages. Hindi and Arabic remain available
+ * at the end of the shortcut band, and every backend language is still present
+ * in the complete alphabetical list below it.
*/
export const COMMON_LANGUAGE_CODES: readonly string[] = [
"en",
- "zh",
- "hi",
+ "de",
"es",
- "ar",
+ "zh",
"fr",
- "bn",
+ "it",
"pt",
- "ru",
- "ur",
- "id",
- "de",
+ "nl",
+ "pl",
+ "sv",
+ "no",
+ "da",
+ "fi",
+ "hi",
+ "ar",
];
// One instance per UI language: constructing an Intl formatter is not free, and
@@ -223,10 +220,10 @@ export interface LanguageOptionGroup {
* the picker draws: the lead entry ("auto"), a short most-likely band, and the
* complete alphabetical list.
*
- * `preferred` is the user's interface language — it heads the common band, so
- * the shortlist is about the person using the app, not about a ranking baked
- * into the source. `keepInCommon` (the currently stored value) is pulled up too,
- * so a saved choice is never a scroll away from where it was picked.
+ * `preferred` is the user's interface language and `keepInCommon` is the
+ * currently stored value. Either is appended when it is not already in the
+ * curated band, so a language outside the shortcuts stays easy to reach without
+ * changing the fixed leading order.
*
* Nothing is hidden: every language appears in the `all` band as well, which is
* what makes the shortlist a convenience rather than a two-tier list.
@@ -250,11 +247,10 @@ export function groupedLanguageOptions(
.filter((c) => c === "auto")
.map((code) => decorate(code, languageName(code, uiLanguage, autoLabel)));
- // Order inside the shortlist: the interface language, then the saved pick,
- // then the world ranking — de-duplicated, and never a code the backend does
- // not actually accept.
+ // Keep the curated leading order stable, then append the interface language
+ // and saved pick when needed. Never add a code the backend does not accept.
const commonCodes: string[] = [];
- for (const code of [preferred, keepInCommon, ...COMMON_LANGUAGE_CODES]) {
+ for (const code of [...COMMON_LANGUAGE_CODES, preferred, keepInCommon]) {
if (!code || code === "auto") continue;
if (!served.has(code)) continue;
if (commonCodes.includes(code)) continue;
diff --git a/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx
index 689047eb92..e824ac8a45 100644
--- a/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx
@@ -77,13 +77,15 @@ describe("LanguagesGroup (Languages folded into Settings)", () => {
);
// ~100 alphabetical entries put Afrikaans, Albanian, Amharic and Armenian
// on the first screen and everything most people speak below the fold.
- // The shortlist is ordered by speakers worldwide, so English, Chinese,
- // Hindi and Spanish come before the A-Z band — and every one of them is
- // still IN that band as well, which is what keeps it a convenience rather
- // than a two-tier list.
+ // The shortcut band keeps the requested leading order, retains Hindi and
+ // Arabic at its end, and still repeats every shortcut in the complete A-Z
+ // band so the feature remains a convenience rather than a restricted list.
const firstAll = values.indexOf("af");
expect(firstAll).toBeGreaterThan(0);
- for (const code of ["en", "zh", "hi", "es", "fr"]) {
+ expect(values.slice(1, 5)).toEqual(["en", "de", "es", "zh"]);
+ const commonBand = values.slice(1, firstAll);
+ expect(commonBand.slice(-2)).toEqual(["hi", "ar"]);
+ for (const code of ["en", "de", "es", "zh", "fr", "hi", "ar"]) {
expect(values.indexOf(code)).toBeLessThan(firstAll);
expect(values.lastIndexOf(code)).toBeGreaterThan(firstAll);
}