Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(server): return a present-but-falsy language table value
lhy-dcff56056f033d6
diff --git a/server/language.test.ts b/server/language.test.tsindex e312921558..8979e046d3 100644--- a/server/language.test.ts+++ b/server/language.test.ts@@ -11,3 +11,10 @@ it("picks the pack the app would: exact, alias, parent, else English", () => {it("formats in the language set, and in US English when none or a bad one is set", () => {expect([intlLocale("pt-br"), intlLocale(undefined), intlLocale("not a locale!")]).toEqual(["pt-BR", "en-US", "en-US"]);});+++it("returns a present-but-falsy value instead of falling back to English", () => {+ expect(byLanguage({ en: true, fr: false }, "fr")).toBe(false);+ expect(byLanguage({ en: "E", fr: "" }, "fr")).toBe("");+ expect(byLanguage({ en: 1, fr: 0 }, "FR")).toBe(0);+});diff --git a/server/language.ts b/server/language.tsindex 22da2a89a1..4fde5ab50b 100644--- a/server/language.ts+++ b/server/language.ts@@ -5,7 +5,7 @@ export function byLanguage<T>(table: { en: T } & Partial<Record<string, T>>, lanlet candidate = language?.trim().toLowerCase() || "en";while (candidate) {const entry = table[ALIASES[candidate] ?? candidate];- if (entry) return entry;+ if (entry !== undefined) return entry;const separator = candidate.lastIndexOf("-");if (separator < 0) break;candidate = candidate.slice(0, separator);