mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-08-04 01:38:41 +02:00
Wire Persian into Telegram OSINT translate labels and locale docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+3
-1
@@ -62,8 +62,10 @@ A PR that adds a new language is harder to review than one that fixes typos in a
|
||||
|
||||
### What about adding a new language?
|
||||
|
||||
We welcome new languages. The mechanical setup is documented in the header comment of `frontend/src/i18n/index.ts`. Beyond that:
|
||||
We welcome new languages. The mechanical setup is documented in the header comment of `frontend/src/i18n/index.tsx`. Beyond that:
|
||||
|
||||
- Register the locale in `backend/services/telegram_translate.py` (`_LOCALE_TO_GOOGLE` and `_SOURCE_LANG_LABELS`) and the matching fallback labels in `frontend/src/components/MaplibreViewer/popups/TelegramOsintPopup.tsx`. Simple codes like `fa` already pass through to Google Translate, but without the labels the UI shows raw codes (e.g. `FA`) for source language, and aliases like `zh` → `zh-CN` need an explicit map entry.
|
||||
- For RTL languages, add the locale to `RTL_LOCALES` in `frontend/src/i18n/index.tsx` and smoke-test the map chrome (sidebar, modals, popups) with that locale selected — `dir="rtl"` can mirror flex layouts that were designed LTR.
|
||||
- We are more likely to merge a new language quickly if at least one reviewer in the maintainer's network speaks it.
|
||||
- If you are the *only* speaker of the target language reading this repo, your translation is welcome but the merge timeline will be longer while a reviewer is found.
|
||||
- Partial translations are fine — the system falls back to English for any missing key.
|
||||
|
||||
@@ -34,6 +34,7 @@ _SOURCE_LANG_LABELS = {
|
||||
"ru": "Russian",
|
||||
"en": "English",
|
||||
"ar": "Arabic",
|
||||
"fa": "Persian",
|
||||
"he": "Hebrew",
|
||||
"zh-cn": "Chinese",
|
||||
"fr": "French",
|
||||
@@ -48,6 +49,7 @@ _CACHE_MAX = 512
|
||||
_LOCALE_TO_GOOGLE = {
|
||||
"en": "en",
|
||||
"fr": "fr",
|
||||
"fa": "fa",
|
||||
"zh-cn": "zh-CN",
|
||||
"zh": "zh-CN",
|
||||
}
|
||||
|
||||
@@ -41,11 +41,13 @@ def test_apply_post_translation_adds_fields(monkeypatch):
|
||||
def test_normalize_translate_target_maps_ui_locales():
|
||||
assert telegram_translate.normalize_translate_target("zh-CN") == "zh-CN"
|
||||
assert telegram_translate.normalize_translate_target("fr") == "fr"
|
||||
assert telegram_translate.normalize_translate_target("fa") == "fa"
|
||||
|
||||
|
||||
def test_source_lang_label_avoids_uk_country_confusion():
|
||||
assert telegram_translate.source_lang_label("uk") == "Ukrainian"
|
||||
assert telegram_translate.source_lang_label("ru") == "Russian"
|
||||
assert telegram_translate.source_lang_label("fa") == "Persian"
|
||||
|
||||
|
||||
def test_polish_translation_expands_bpla_shorthand():
|
||||
|
||||
@@ -83,6 +83,7 @@ function sourceLangLabel(post: TelegramOsintPost): string {
|
||||
ru: 'Russian',
|
||||
en: 'English',
|
||||
ar: 'Arabic',
|
||||
fa: 'Persian',
|
||||
he: 'Hebrew',
|
||||
'zh-cn': 'Chinese',
|
||||
fr: 'French',
|
||||
|
||||
@@ -24,7 +24,12 @@ const RTL_LOCALES: ReadonlySet<Locale> = new Set(['fa']);
|
||||
* 2. Import it above and add to `translations` below
|
||||
* 3. Add an entry here
|
||||
* 4. Extend the `Locale` type
|
||||
* 5. Read CONTRIBUTING.md — translations must be technically faithful
|
||||
* 5. If the language is RTL, add its code to `RTL_LOCALES`
|
||||
* 6. Map the locale in `backend/services/telegram_translate.py`
|
||||
* (`_LOCALE_TO_GOOGLE` + `_SOURCE_LANG_LABELS`) and the fallback
|
||||
* labels in `TelegramOsintPopup.tsx` so Telegram OSINT posts
|
||||
* translate into the UI language
|
||||
* 7. Read CONTRIBUTING.md — translations must be technically faithful
|
||||
* to the English source. Politically loaded substitutions or
|
||||
* framing aligned with state propaganda from ANY country will
|
||||
* be rejected.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"brand": {
|
||||
"title": "S H A D O W B R O K E R",
|
||||
"title": "S H A D O W B R O K E R",
|
||||
"subtitle": "رهگیری تهدیدات جهانی",
|
||||
"systemMetrics": "OPTIC VIS:113 SRC:180 DENS:1.42 0.8ms"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user