Add Persian viewer and tutorial translations
This commit is contained in:
parent
90bdce2021
commit
17846a9d7a
21 changed files with 1239 additions and 16 deletions
|
|
@ -24,6 +24,7 @@ const locales = [
|
|||
"vi",
|
||||
"it",
|
||||
"nl",
|
||||
"fa",
|
||||
];
|
||||
for (const locale of locales) {
|
||||
const catalog = JSON.parse(
|
||||
|
|
|
|||
|
|
@ -83,3 +83,8 @@ test("tutorial progress prefixes preserve whole-title translations before generi
|
|||
"1/3 · Une leçon pour tous",
|
||||
);
|
||||
});
|
||||
|
||||
test("Persian regional tags select Farsi", () => {
|
||||
assert.equal(resolveLocale("fa-IR"), "fa");
|
||||
assert.equal(resolveLocale("fa_IR"), "fa");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,3 +9,5 @@ The rendering adapter translates text and accessible labels, including tooltips,
|
|||
For rich text that is split into icons and spans, call `translateText` on the complete sentence before splitting it; localize the tokenizer's resource labels too. This preserves sentence grammar. Avoid relying on rendered labels to identify an action—use action IDs or data attributes.
|
||||
|
||||
Run `node scripts/check-locales.mjs viewer/localization` to verify catalogue coverage and placeholders. The viewer's normal build and browser tests should also cover language switching, action controls, translated tutorial progression and narrow layouts. Browser text must remain readable if a translation is missing; English is the fallback.
|
||||
|
||||
Persian (`fa`, including `fa-IR`) uses RTL text isolates. Board geometry and controls keep their existing layout. Technical extraction identifiers remain verbatim.
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amøber. Hver ny amøbe koster 6 BP og placeres ved siden af en af dine egne, uden at dele din farves felt. Med én amøbe kan den anden placeres hvor som helst. Uden nogen vender den første tilbage hvor som helst gratis.",
|
||||
"gene when calculating evolution points.": "gen ved beregning af evolutionspoint.",
|
||||
"genes when calculating evolution points.": "gener ved beregning af evolutionspoint.",
|
||||
"unrevealed · +2 per round": "ikke afsløret · +2 pr. runde"
|
||||
"unrevealed · +2 per round": "ikke afsløret · +2 pr. runde",
|
||||
"Buyable": "Kan købes",
|
||||
"Show only genes you can buy or exchange now.": "Vis kun gener, du kan købe eller få ved bytte nu.",
|
||||
"No genes available to buy.": "Ingen gener kan købes."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "Amöben. Jede neue Amöbe kostet 6 BP und kommt neben eine deiner Amöben, ohne sich den Raum deiner Farbe zu teilen. Mit einer Amöbe darf die zweite überall hin. Mit keiner kehrt die erste kostenlos irgendwohin zurück.",
|
||||
"gene when calculating evolution points.": "Gen bei der Berechnung der Evolutionspunkte.",
|
||||
"genes when calculating evolution points.": "Gene bei der Berechnung der Evolutionspunkte.",
|
||||
"unrevealed · +2 per round": "nicht aufgedeckt · +2 pro Runde"
|
||||
"unrevealed · +2 per round": "nicht aufgedeckt · +2 pro Runde",
|
||||
"Buyable": "Kaufbar",
|
||||
"Show only genes you can buy or exchange now.": "Nur Gene anzeigen, die du jetzt kaufen oder durch Tausch erhalten kannst.",
|
||||
"No genes available to buy.": "Keine Gene zum Kaufen verfügbar."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "αμοιβάδες. Κάθε νέα αμοιβάδα κοστίζει 6 ΒΠ και τοποθετείται δίπλα σε μία δική σου, χωρίς να μοιράζεται το χώρο του χρώματός σου. Με μία αμοιβάδα, η δεύτερη μπορεί να μπει οπουδήποτε. Χωρίς καμία, η πρώτη επιστρέφει οπουδήποτε δωρεάν.",
|
||||
"gene when calculating evolution points.": "γονίδιο κατά τον υπολογισμό πόντων εξέλιξης.",
|
||||
"genes when calculating evolution points.": "γονίδια κατά τον υπολογισμό πόντων εξέλιξης.",
|
||||
"unrevealed · +2 per round": "κρυφά · +2 ανά γύρο"
|
||||
"unrevealed · +2 per round": "κρυφά · +2 ανά γύρο",
|
||||
"Buyable": "Διαθέσιμα για αγορά",
|
||||
"Show only genes you can buy or exchange now.": "Εμφάνιση μόνο των γονιδίων που μπορείς να αγοράσεις ή να αποκτήσεις με ανταλλαγή τώρα.",
|
||||
"No genes available to buy.": "Δεν υπάρχουν γονίδια διαθέσιμα για αγορά."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.",
|
||||
"gene when calculating evolution points.": "gene when calculating evolution points.",
|
||||
"genes when calculating evolution points.": "genes when calculating evolution points.",
|
||||
"unrevealed · +2 per round": "unrevealed · +2 per round"
|
||||
"unrevealed · +2 per round": "unrevealed · +2 per round",
|
||||
"Buyable": "Buyable",
|
||||
"Show only genes you can buy or exchange now.": "Show only genes you can buy or exchange now.",
|
||||
"No genes available to buy.": "No genes available to buy."
|
||||
}
|
||||
|
|
|
|||
1163
viewer/localization/fa.json
Normal file
1163
viewer/localization/fa.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amibes. Chaque nouvelle amibe coûte 6 PB et se place à côté de l'une des vôtres, sans partager l'espace de votre couleur. Avec une amibe, la deuxième peut aller n'importe où. Sans aucune, la première revient n'importe où gratuitement.",
|
||||
"gene when calculating evolution points.": "gène lors du calcul des points d'évolution.",
|
||||
"genes when calculating evolution points.": "gènes lors du calcul des points d'évolution.",
|
||||
"unrevealed · +2 per round": "non révélé · +2 par manche"
|
||||
"unrevealed · +2 per round": "non révélé · +2 par manche",
|
||||
"Buyable": "Achetables",
|
||||
"Show only genes you can buy or exchange now.": "Afficher uniquement les gènes que vous pouvez acheter ou obtenir par échange maintenant.",
|
||||
"No genes available to buy.": "Aucun gène ne peut être acheté."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "अमीबा। हर नए अमीबा की कीमत 6 BP है और वह तुम्हारे किसी अमीबा के बगल में जाता है, तुम्हारे रंग की जगह साझा किए बिना। एक अमीबा होने पर, दूसरा कहीं भी जा सकता है। कोई नहीं होने पर, पहला कहीं भी मुफ़्त लौटता है।",
|
||||
"gene when calculating evolution points.": "विकास अंक गिनते समय जीन।",
|
||||
"genes when calculating evolution points.": "विकास अंक गिनते समय जीन।",
|
||||
"unrevealed · +2 per round": "अप्रकट · +2 प्रति राउंड"
|
||||
"unrevealed · +2 per round": "अप्रकट · +2 प्रति राउंड",
|
||||
"Buyable": "खरीदने योग्य",
|
||||
"Show only genes you can buy or exchange now.": "केवल वे जीन दिखाएँ जिन्हें आप अभी खरीद सकते हैं या अदला-बदली से पा सकते हैं।",
|
||||
"No genes available to buy.": "खरीदने के लिए कोई जीन उपलब्ध नहीं है।"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import catalog11 from "./zh-TW.json";
|
|||
import catalog12 from "./vi.json";
|
||||
import catalog13 from "./it.json";
|
||||
import catalog14 from "./nl.json";
|
||||
import catalog15 from "./fa.json";
|
||||
import { mountLocalization as mount, createTranslator } from "./runtime.js";
|
||||
export { languages, resolveLocale } from "./runtime.js";
|
||||
export const catalogs = {
|
||||
|
|
@ -33,6 +34,7 @@ export const catalogs = {
|
|||
vi: catalog12,
|
||||
it: catalog13,
|
||||
nl: catalog14,
|
||||
fa: catalog15,
|
||||
};
|
||||
const translators = new Map();
|
||||
export function translateText(text, locale = "en") {
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amebe. Ogni nuova ameba costa 6 PB e va accanto a una delle tue, senza condividere lo spazio del tuo colore. Con un'ameba, la seconda può andare ovunque. Senza nessuna, la prima ritorna ovunque gratuitamente.",
|
||||
"gene when calculating evolution points.": "gene nel calcolo dei punti evoluzione.",
|
||||
"genes when calculating evolution points.": "geni nel calcolo dei punti evoluzione.",
|
||||
"unrevealed · +2 per round": "non rivelato · +2 per round"
|
||||
"unrevealed · +2 per round": "non rivelato · +2 per round",
|
||||
"Buyable": "Acquistabili",
|
||||
"Show only genes you can buy or exchange now.": "Mostra solo i geni che puoi acquistare o ottenere con uno scambio adesso.",
|
||||
"No genes available to buy.": "Nessun gene disponibile per l’acquisto."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "아메바. 새 아메바는 각각 6 BP가 들며, 자기 색 공간을 공유하지 않고 자신의 아메바 옆에 놓입니다. 아메바가 하나면 두 번째는 아무 데나 놓을 수 있습니다. 없으면 첫 번째는 무료로 아무 데나 돌아옵니다.",
|
||||
"gene when calculating evolution points.": "진화 점수를 계산할 때 유전자.",
|
||||
"genes when calculating evolution points.": "진화 점수를 계산할 때 유전자들.",
|
||||
"unrevealed · +2 per round": "미공개 · 라운드당 +2"
|
||||
"unrevealed · +2 per round": "미공개 · 라운드당 +2",
|
||||
"Buyable": "구매 가능",
|
||||
"Show only genes you can buy or exchange now.": "지금 구매하거나 교환으로 얻을 수 있는 유전자만 표시합니다.",
|
||||
"No genes available to buy.": "구매할 수 있는 유전자가 없습니다."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amoeben. Elke nieuwe amoebe kost 6 BP en komt naast een van jouw amoeben te liggen, zonder de ruimte van jouw kleur te delen. Met één amoebe mag de tweede overal komen. Met geen enkele komt de eerste gratis overal terug.",
|
||||
"gene when calculating evolution points.": "gen bij het berekenen van evolutiepunten.",
|
||||
"genes when calculating evolution points.": "genen bij het berekenen van evolutiepunten.",
|
||||
"unrevealed · +2 per round": "niet onthuld · +2 per ronde"
|
||||
"unrevealed · +2 per round": "niet onthuld · +2 per ronde",
|
||||
"Buyable": "Te koop",
|
||||
"Show only genes you can buy or exchange now.": "Toon alleen genen die je nu kunt kopen of via ruil kunt krijgen.",
|
||||
"No genes available to buy.": "Er zijn geen genen die je kunt kopen."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "ameby. Każda nowa ameba kosztuje 6 PB i trafia obok jednej z twoich, nie dzieląc pola z twoim kolorem. Z jedną amebą druga może trafić gdziekolwiek. Bez żadnej pierwsza wraca gdziekolwiek za darmo.",
|
||||
"gene when calculating evolution points.": "gen przy obliczaniu punktów ewolucji.",
|
||||
"genes when calculating evolution points.": "geny przy obliczaniu punktów ewolucji.",
|
||||
"unrevealed · +2 per round": "nieodkryte · +2 na rundę"
|
||||
"unrevealed · +2 per round": "nieodkryte · +2 na rundę",
|
||||
"Buyable": "Do kupienia",
|
||||
"Show only genes you can buy or exchange now.": "Pokaż tylko geny, które możesz teraz kupić lub uzyskać w wymianie.",
|
||||
"No genes available to buy.": "Brak genów możliwych do kupienia."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amebas. Cada nova ameba custa 6 PB e vai para perto de uma das suas, sem compartilhar o espaço da sua cor. Com uma ameba, a segunda pode ir para qualquer lugar. Sem nenhuma, a primeira retorna para qualquer lugar de graça.",
|
||||
"gene when calculating evolution points.": "gene ao calcular pontos de evolução.",
|
||||
"genes when calculating evolution points.": "genes ao calcular pontos de evolução.",
|
||||
"unrevealed · +2 per round": "não revelado · +2 por rodada"
|
||||
"unrevealed · +2 per round": "não revelado · +2 por rodada",
|
||||
"Buyable": "Compráveis",
|
||||
"Show only genes you can buy or exchange now.": "Mostrar apenas genes que você pode comprar ou obter por troca agora.",
|
||||
"No genes available to buy.": "Nenhum gene disponível para compra."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amibe. Fiecare amibă nouă costă 6 PB și se plasează lângă una dintre ale tale, fără a împărți spațiul culorii tale. Cu o amibă, a doua poate merge oriunde. Fără niciuna, prima revine oriunde gratuit.",
|
||||
"gene when calculating evolution points.": "genă la calcularea punctelor de evoluție.",
|
||||
"genes when calculating evolution points.": "gene la calcularea punctelor de evoluție.",
|
||||
"unrevealed · +2 per round": "nedezvăluit · +2 pe rundă"
|
||||
"unrevealed · +2 per round": "nedezvăluit · +2 pe rundă",
|
||||
"Buyable": "Disponibile pentru cumpărare",
|
||||
"Show only genes you can buy or exchange now.": "Arată doar genele pe care le poți cumpăra sau obține prin schimb acum.",
|
||||
"No genes available to buy.": "Nu există gene pe care le poți cumpăra."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "амёбы. Каждая новая амёба стоит 6 БО и ставится рядом с одной из твоих, не занимая клетку твоего цвета. С одной амёбой вторую можно поставить куда угодно. Без амёб первая возвращается куда угодно бесплатно.",
|
||||
"gene when calculating evolution points.": "ген при подсчёте очков эволюции.",
|
||||
"genes when calculating evolution points.": "гены при подсчёте очков эволюции.",
|
||||
"unrevealed · +2 per round": "нераскрыто · +2 за раунд"
|
||||
"unrevealed · +2 per round": "нераскрыто · +2 за раунд",
|
||||
"Buyable": "Можно купить",
|
||||
"Show only genes you can buy or exchange now.": "Показать только гены, которые можно сейчас купить или получить обменом.",
|
||||
"No genes available to buy.": "Нет генов, доступных для покупки."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export const languages = {
|
|||
vi: "Tiếng Việt",
|
||||
it: "Italiano",
|
||||
nl: "Nederlands",
|
||||
fa: "فارسی",
|
||||
};
|
||||
|
||||
export function resolveLocale(value) {
|
||||
|
|
@ -228,7 +229,11 @@ export function mountLocalization(
|
|||
const key = attribute ?? "text";
|
||||
const previous = record.get(key);
|
||||
const source = previous?.output === value ? previous.source : value;
|
||||
const output = translator.translate(source);
|
||||
const translated = translator.translate(source);
|
||||
const output =
|
||||
translator.locale === "fa" && /[\u0600-\u06ff]/.test(translated)
|
||||
? `\u2067${translated}\u2069`
|
||||
: translated;
|
||||
record.set(key, { source, output });
|
||||
if (value !== output) {
|
||||
if (attribute) {
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "amip. Mỗi amip mới tốn 6 BP và đặt cạnh một amip của bạn, không chia sẻ ô màu của bạn. Với một amip, amip thứ hai có thể đặt bất kỳ đâu. Không có amip nào, amip đầu tiên quay lại bất kỳ đâu miễn phí.",
|
||||
"gene when calculating evolution points.": "gen khi tính điểm tiến hóa.",
|
||||
"genes when calculating evolution points.": "các gen khi tính điểm tiến hóa.",
|
||||
"unrevealed · +2 per round": "chưa lộ · +2 mỗi vòng"
|
||||
"unrevealed · +2 per round": "chưa lộ · +2 mỗi vòng",
|
||||
"Buyable": "Có thể mua",
|
||||
"Show only genes you can buy or exchange now.": "Chỉ hiển thị các gen bạn có thể mua hoặc nhận qua trao đổi ngay bây giờ.",
|
||||
"No genes available to buy.": "Không có gen nào có thể mua."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1156,5 +1156,8 @@
|
|||
"amoebas. Each new amoeba costs 6 BP and goes next to one of yours, without sharing your colour's space. With one amoeba, the second may go anywhere. With none, the first returns anywhere for free.": "變形蟲。每隻新變形蟲花費 6 BP,並放在你的一隻旁邊,不可佔用你顏色的格子。有一隻變形蟲時,第二隻可放在任意位置。沒有的話,第一隻免費回到任意位置。",
|
||||
"gene when calculating evolution points.": "基因來計算演化點數。",
|
||||
"genes when calculating evolution points.": "基因來計算演化點數。",
|
||||
"unrevealed · +2 per round": "未揭示 · 每輪 +2"
|
||||
"unrevealed · +2 per round": "未揭示 · 每輪 +2",
|
||||
"Buyable": "可購買",
|
||||
"Show only genes you can buy or exchange now.": "僅顯示目前可以購買或交換取得的基因。",
|
||||
"No genes available to buy.": "目前沒有可購買的基因。"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue