Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Merge main into feat/i18n-turkish

Steven Enamakel29bb8f18683f
diff --cc app/src/components/LanguageSelect.test.tsx
index 73211ea28d,6c0e21a21f..29da120cd1
--- a/app/src/components/LanguageSelect.test.tsx
+++ b/app/src/components/LanguageSelect.test.tsx
@@@ -27,28 -27,28 +27,53 @@@ function renderPicker()
}
describe('LanguageSelect', () => {
+ it('offers Turkish in its own language and applies it immediately', () => {
+ const store = renderPicker();
+ expect(screen.getByRole('option', { name: '🇹🇷 Türkçe' })).toHaveValue('tr');
+
+ fireEvent.change(screen.getByRole('combobox'), { target: { value: 'tr' } });
+
+ expect(store.getState().locale.current).toBe('tr');
+ expect(screen.getByRole('combobox')).toHaveValue('tr');
+ expect(screen.getByText('Dil')).toBeInTheDocument();
+ expect(document.documentElement.lang).toBe('tr');
+ expect(document.documentElement.dir).toBe('ltr');
+ });
+
+ it('switches back to English after Turkish', () => {
+ const store = renderPicker();
+ const picker = screen.getByRole('combobox');
+ fireEvent.change(picker, { target: { value: 'tr' } });
+ fireEvent.change(picker, { target: { value: 'en' } });
+
+ expect(store.getState().locale.current).toBe('en');
+ expect(picker).toHaveValue('en');
+ expect(screen.getByText('Language')).toBeInTheDocument();
+ expect(document.documentElement.lang).toBe('en');
+ });
++
+ it('offers Japanese in its native script and applies it immediately', () => {
+ const store = renderPicker();
+ expect(screen.getByRole('option', { name: '🇯🇵 日本語' })).toHaveValue('ja');
+
+ fireEvent.change(screen.getByRole('combobox'), { target: { value: 'ja' } });
+
+ expect(store.getState().locale.current).toBe('ja');
+ expect(screen.getByRole('combobox')).toHaveValue('ja');
+ expect(screen.getByText('言語')).toBeInTheDocument();
+ expect(document.documentElement.lang).toBe('ja');
+ expect(document.documentElement.dir).toBe('ltr');
+ });
+
+ it('can switch back to English after Japanese', () => {
+ const store = renderPicker();
+ const picker = screen.getByRole('combobox');
+ fireEvent.change(picker, { target: { value: 'ja' } });
+ fireEvent.change(picker, { target: { value: 'en' } });
+
+ expect(store.getState().locale.current).toBe('en');
+ expect(picker).toHaveValue('en');
+ expect(screen.getByText('Language')).toBeInTheDocument();
+ expect(document.documentElement.lang).toBe('en');
+ });
});
diff --cc app/src/lib/i18n/__tests__/coverage.test.ts
index 0b1b8e13b4,09b90550a9..b2ed410cef
--- a/app/src/lib/i18n/__tests__/coverage.test.ts
+++ b/app/src/lib/i18n/__tests__/coverage.test.ts
@@@ -14,9 -14,9 +14,10 @@@ const LOCALES =
'ru',
'id',
'it',
+ 'ja',
'ko',
'pl',
+ 'tr',
] as const;
interface LocaleModule {
@@@ -55,18 -55,19 +56,31 @@@ describe('i18n coverage', () =>
expect(extra).toEqual([]);
});
+ it('locale tr preserves every interpolation placeholder', () => {
+ const turkish = loadLocale('tr');
+ const placeholders = (value: string) => (value.match(/\{+[^{}]+\}+/g) ?? []).sort();
+ const mismatches = Object.entries(enFlat)
+ .filter(
+ ([key, value]) =>
+ JSON.stringify(placeholders(turkish[key] ?? '')) !== JSON.stringify(placeholders(value))
+ )
+ .map(([key]) => key);
+ expect(mismatches).toEqual([]);
+ });
+
+ it('preserves Japanese interpolation placeholders exactly', () => {
+ const japanese = loadLocale('ja');
+ const placeholders = (value: string) => value.match(/\{+[^{}]+\}+/g)?.sort() ?? [];
+ const mismatches = Object.entries(enFlat)
+ .filter(
+ ([key, value]) =>
+ JSON.stringify(placeholders(japanese[key])) !== JSON.stringify(placeholders(value))
+ )
+ .map(([key]) => key);
+
+ expect(mismatches).toEqual([]);
+ });
+
it.each(['en', ...LOCALES])('locale %s contains no em dashes', locale => {
const flat = locale === 'en' ? enFlat : loadLocale(locale);
const keysWithEmDashes = Object.entries(flat)
diff --cc app/src/lib/i18n/types.ts
index ac6c1d0834,19ba1cce00..18c8082124
--- a/app/src/lib/i18n/types.ts
+++ b/app/src/lib/i18n/types.ts
@@@ -11,9 -11,9 +11,10 @@@ export type Locale
| 'ru'
| 'id'
| 'it'
+ | 'ja'
| 'ko'
- | 'pl';
+ | 'pl'
+ | 'tr';
export interface TranslationMap {
[key: string]: string;
diff --cc app/src/store/localeSlice.test.ts
index fcf85e9517,d43c5fbeae..a65b0821cf
--- a/app/src/store/localeSlice.test.ts
+++ b/app/src/store/localeSlice.test.ts
@@@ -31,11 -31,31 +31,38 @@@ describe('localeSlice', () =>
expect(reducer(undefined, { type: '@@INIT' }).current).toBe('id');
});
+
+ it.each(['tr', 'tr-TR', 'TR-tr'])('detects the Turkish browser locale %s', async language => {
+ vi.stubGlobal('navigator', { language });
+ const reducer = await loadReducer();
+
+ expect(reducer(undefined, { type: '@@INIT' }).current).toBe('tr');
+ });
});
+
+ describe('Japanese locale detection', () => {
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ });
+
+ it.each(['ja', 'ja-JP', 'JA-jp'])('detects browser language %s', async language => {
+ vi.stubGlobal('navigator', { language });
+ const reducer = await loadReducer();
+
+ expect(reducer(undefined, { type: '@@INIT' }).current).toBe('ja');
+ });
+
+ it.each(['', 'unsupported'])('keeps the English fallback for %s', async language => {
+ vi.stubGlobal('navigator', { language });
+ const reducer = await loadReducer();
+
+ expect(reducer(undefined, { type: '@@INIT' }).current).toBe('en');
+ });
+
+ it('keeps the English fallback without the browser API', async () => {
+ vi.stubGlobal('navigator', undefined);
+ const reducer = await loadReducer();
+
+ expect(reducer(undefined, { type: '@@INIT' }).current).toBe('en');
+ });
+ });
diff --cc scripts/apply-i18n-translations.ts
index 518484fb2f,e18a909602..5bd861fb1b
--- a/scripts/apply-i18n-translations.ts
+++ b/scripts/apply-i18n-translations.ts
@@@ -39,9 -39,9 +39,10 @@@ const LOCALE_HEADERS: Record<string, st
ru: "Russian (Русский)",
id: "Indonesian (Bahasa Indonesia)",
it: "Italian (Italiano)",
+ ja: "Japanese (日本語)",
ko: "Korean (한국어)",
pl: "Polish (Polski)",
+ tr: "Turkish (Türkçe)",
};
interface InputFile {
diff --cc scripts/i18n-coverage.ts
index 2ebddbc51c,e458c564e6..eb99e65699
--- a/scripts/i18n-coverage.ts
+++ b/scripts/i18n-coverage.ts
@@@ -42,9 -42,9 +42,10 @@@ const ALL_LOCALES =
"ru",
"id",
"it",
+ "ja",
"ko",
"pl",
+ "tr",
] as const;
type Locale = (typeof ALL_LOCALES)[number];
diff --cc scripts/i18n-find-english.ts
index 02af2cfd65,4e543f982a..3c4107b6d4
--- a/scripts/i18n-find-english.ts
+++ b/scripts/i18n-find-english.ts
@@@ -10,10 -10,10 +10,10 @@@
* Detection strategy (per locale):
* - Technical literals are skipped (pure placeholders, URLs, single-token identifiers,
* file paths, commands, values with no real word).
- * - Non-Latin-script locales (zh-CN, hi, bn, ar, ru, ko): a non-technical value that
+ * - Non-Latin-script locales (zh-CN, hi, bn, ar, ru, ko, ja): a non-technical value that
* contains NO character of the locale's native script is treated as English.
* (High recall — vocabulary-independent.)
- * - Latin-script locales (de, es, fr, it, pt, id, pl): a non-technical value is flagged
+ * - Latin-script locales (de, es, fr, it, pt, id, pl, tr): a non-technical value is flagged
* when it is identical to the current English value, OR when it contains >= 2 distinct
* English-only function words (the/and/while/may/your/…) that do not exist in any of
* these languages. (A vocabulary-ratio test is unreliable here because French/Spanish/