🇹🇷 localize the settings duplicate-entry error
Browse files at this commita8053b3d77d922b4811ed384150f028ac89bd0f5Parent: d5f7156- fix
- 🇹🇷 localize the settings duplicate-entry error
2 changed files +27 -0
src/api/__tests__/client/client.test.tsmodified+17 -0
| @@ -124,6 +124,23 @@ describe("client", () => { | |||
| 124 | expect(formatApiErrorMessage("forbidden", "tr")).toBe("Bu işlem için yetkin yok."); | 124 | expect(formatApiErrorMessage("forbidden", "tr")).toBe("Bu işlem için yetkin yok."); |
| 125 | }); | 125 | }); |
| 126 | 126 | ||
| 127 | + it("localizes the settings duplicate-entry error (Turkish casing)", () => { | ||
| 128 | + // exact backend strings from settings.rs validate_list — a miss here renders | ||
| 129 | + // "İşlem tamamlanamadı: <raw English>" to a Turkish admin | ||
| 130 | + const kinds = "exam_kinds: two entries are the same word apart from upper/lower case or Turkish letters — keep only one of them"; | ||
| 131 | + const statuses = | ||
| 132 | + "attendance_statuses: two entries are the same word apart from upper/lower case or Turkish letters — keep only one of them"; | ||
| 133 | + expect(formatApiErrorMessage(kinds, "tr")).toBe( | ||
| 134 | + "İki sınav türü, büyük/küçük harf veya Türkçe harf farkı dışında aynı. Sadece birini bırak.", | ||
| 135 | + ); | ||
| 136 | + expect(formatApiErrorMessage(statuses, "tr")).toBe( | ||
| 137 | + "İki yoklama durumu, büyük/küçük harf veya Türkçe harf farkı dışında aynı. Sadece birini bırak.", | ||
| 138 | + ); | ||
| 139 | + expect(formatApiErrorMessage(kinds, "en")).toBe( | ||
| 140 | + "Two exam kinds are the same word apart from upper/lower case or Turkish letters. Keep only one of them.", | ||
| 141 | + ); | ||
| 142 | + }); | ||
| 143 | + | ||
| 127 | it("localizes slot-overlap conflicts (no half-English fallback)", () => { | 144 | it("localizes slot-overlap conflicts (no half-English fallback)", () => { |
| 128 | // exact backend strings (lowercase) must map, not fall through to "İşlem tamamlanamadı: <english>" | 145 | // exact backend strings (lowercase) must map, not fall through to "İşlem tamamlanamadı: <english>" |
| 129 | expect(formatApiErrorMessage("this time overlaps a slot you have already published", "tr")).toBe( | 146 | expect(formatApiErrorMessage("this time overlaps a slot you have already published", "tr")).toBe( |
src/api/client/client.tsmodified+10 -0
| @@ -22,6 +22,16 @@ type RequestOptions = { | |||
| 22 | const API_PREFIX = "/api"; | 22 | const API_PREFIX = "/api"; |
| 23 | 23 | ||
| 24 | const API_ERROR_MESSAGES: Record<string, Record<Locale, string>> = { | 24 | const API_ERROR_MESSAGES: Record<string, Record<Locale, string>> = { |
| 25 | + // Settings lists reject two entries that fold to the same word — İZİN/izin, | ||
| 26 | + // ÖDEV/odev. Keyed on the whole normalized string, so both fields are listed. | ||
| 27 | + "exam_kinds: two entries are the same word apart from upper/lower case or turkish letters — keep only one of them": { | ||
| 28 | + en: "Two exam kinds are the same word apart from upper/lower case or Turkish letters. Keep only one of them.", | ||
| 29 | + tr: "İki sınav türü, büyük/küçük harf veya Türkçe harf farkı dışında aynı. Sadece birini bırak.", | ||
| 30 | + }, | ||
| 31 | + "attendance_statuses: two entries are the same word apart from upper/lower case or turkish letters — keep only one of them": { | ||
| 32 | + en: "Two attendance statuses are the same word apart from upper/lower case or Turkish letters. Keep only one of them.", | ||
| 33 | + tr: "İki yoklama durumu, büyük/küçük harf veya Türkçe harf farkı dışında aynı. Sadece birini bırak.", | ||
| 34 | + }, | ||
| 25 | "request failed": { | 35 | "request failed": { |
| 26 | en: "Request failed.", | 36 | en: "Request failed.", |
| 27 | tr: "İşlem tamamlanamadı.", | 37 | tr: "İşlem tamamlanamadı.", |