mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-26 02:37:01 -06:00
i18n: add Turkish (tr) localization
- Add crates/ui-egui/src/i18n/tr.tsv covering all menu strings, commands, UI labels, and status/error messages with standard Turkish vector software vocabulary. - Register Turkish in LANGUAGES with plural_none and complete_menus: true. - Support tr, tr-TR, tr_TR.UTF-8, tr-CY locale mapping in lang_from_tag. - Add Turkish typographic quotation marks in crates/doc/src/setup.rs. - Add turkish_reads_as_turkish unit test and register tr in KEEPS_MENU_NAMES and COMPLETE_MESSAGES. - Include RTF diagnostic message with exact TSV escaping.
This commit is contained in:
@@ -154,6 +154,7 @@ pub const LANGUAGES: &[(&str, Quotes)] = &[
|
||||
("Polish", Quotes { double: ['„', '”'], single: ['‚', '’'] }),
|
||||
("Czech", Quotes { double: ['„', '“'], single: ['‚', '‘'] }),
|
||||
("Russian", Quotes { double: ['«', '»'], single: ['„', '“'] }),
|
||||
("Turkish", Quotes { double: ['“', '”'], single: ['‘', '’'] }),
|
||||
("Japanese", Quotes { double: ['「', '」'], single: ['『', '』'] }),
|
||||
("Chinese", Quotes { double: ['“', '”'], single: ['‘', '’'] }),
|
||||
];
|
||||
|
||||
@@ -78,6 +78,7 @@ fn unit(d: &Dialog) -> Unit {
|
||||
Unit::named(&d.str("units")).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The General tab of Document Setup (units, bleed, artboard editing, options).
|
||||
fn general(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
let units: Vec<(&str, &str)> = Unit::ALL.iter().map(|u| (u.label(), u.label())).collect();
|
||||
choice(ui, d, "units", tl!("Units:"), &units);
|
||||
|
||||
@@ -94,7 +94,7 @@ fn plural_polish(n: u64) -> usize {
|
||||
}
|
||||
|
||||
/// The registry. English first: it is the fallback and the source language.
|
||||
pub static LANGUAGES: [LangInfo; 24] = [
|
||||
pub static LANGUAGES: [LangInfo; 25] = [
|
||||
LangInfo { code: "en", name: "English", source: "", plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() },
|
||||
// Greek: the whole interface and the status and error messages, keeping the same names in
|
||||
// English as Spanish; every `el-*` locale (including `el-GR` and `el-CY`) resolves here.
|
||||
@@ -263,6 +263,10 @@ pub static LANGUAGES: [LangInfo; 24] = [
|
||||
// English as Spanish; one/other plurals with the partitive after any number but 1 ("2 tasoa").
|
||||
// Every `fi-*` locale resolves here.
|
||||
LangInfo { code: "fi", name: "Suomi", source: include_str!("fi.tsv"), plural: plural_one_other, complete_menus: true, catalog: OnceLock::new() },
|
||||
// Turkish: the whole interface and the status and error messages, keeping the same names in
|
||||
// English as Spanish; a count takes the singular ("3 katman"), so plurals have one form. Every
|
||||
// `tr-*` locale (including `tr-TR` and `tr-CY`) resolves here.
|
||||
LangInfo { code: "tr", name: "Türkçe", source: include_str!("tr.tsv"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
|
||||
];
|
||||
|
||||
impl LangInfo {
|
||||
|
||||
@@ -870,7 +870,7 @@ fn cs() -> Lang {
|
||||
}
|
||||
|
||||
/// Languages whose catalogs leave [`MENU_KEEP_AS_IS`] in English.
|
||||
const KEEPS_MENU_NAMES: [&str; 17] = ["cs", "de", "el", "es", "fr", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi"];
|
||||
const KEEPS_MENU_NAMES: [&str; 18] = ["cs", "de", "el", "es", "fr", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr"];
|
||||
|
||||
/// Menu labels the menu-complete catalogs (Czech, German, Spanish, Italian, Japanese, Brazilian Portuguese) show as they are: the product name, a format name, the built-in workspace
|
||||
/// names and the perspective grid presets (names, shown untranslated wherever else they appear).
|
||||
@@ -1190,6 +1190,41 @@ fn finnish_reads_as_finnish() {
|
||||
assert_eq!(message(fi(), nested), "komento `object.group` ei ole nyt käytettävissä: mitään ei ole valittu");
|
||||
}
|
||||
|
||||
/// The Turkish catalog registers under `tr`, claims complete menus and messages, and passes
|
||||
/// locale resolution, vocabulary and count formatting checks.
|
||||
#[test]
|
||||
fn turkish_reads_as_turkish() {
|
||||
assert_eq!(tr_lang().name(), "Türkçe");
|
||||
assert!(tr_lang().complete_menus());
|
||||
assert_eq!(Lang::from_pref("tr"), tr_lang());
|
||||
assert_eq!(Lang::from_pref("TR"), tr_lang());
|
||||
for tag in ["tr", "tr-TR", "tr_TR.UTF-8", "TR-tr", "tr-CY"] {
|
||||
assert_eq!(lang_from_tag(tag), Some(tr_lang()), "{tag}");
|
||||
}
|
||||
for (en, want) in [
|
||||
("Artboard Tool", "Çalışma Yüzeyi Aracı"),
|
||||
("Swatches", "Renk Örnekleri"),
|
||||
("Stroke", "Kontur"),
|
||||
("Fill", "Dolgu"),
|
||||
("Direct Selection Tool", "Doğrudan Seçim Aracı"),
|
||||
("Save As…", "Farklı Kaydet…"),
|
||||
("Undo", "Geri Al"),
|
||||
("Close", "Kapat"),
|
||||
] {
|
||||
assert_eq!(tr(tr_lang(), en), want);
|
||||
}
|
||||
for n in [0, 1, 3, 21] {
|
||||
assert_eq!(trn(tr_lang(), n, "{n} Layer", "{n} Layers"), format!("{n} Katman"));
|
||||
}
|
||||
let nested = "command `object.group` is not available right now: nothing selected";
|
||||
assert_eq!(message(tr_lang(), nested), "`object.group` komutu şu anda kullanılamıyor: hiçbir şey seçilmedi");
|
||||
}
|
||||
|
||||
/// The [`Lang`] handle for the Turkish catalog.
|
||||
fn tr_lang() -> Lang {
|
||||
Lang::from_code("tr").expect("tr registered")
|
||||
}
|
||||
|
||||
/// Ambiguous English terms keep their intended Vietnamese meaning across UI contexts.
|
||||
#[test]
|
||||
fn vietnamese_domain_terms_are_consistent() {
|
||||
@@ -2104,7 +2139,7 @@ fn shared_param_check_errors_are_translated() {
|
||||
|
||||
/// Languages whose catalogs cover every status and error message.
|
||||
const COMPLETE_MESSAGES: &[&str] =
|
||||
&["cs", "de", "el", "es", "fr", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi"];
|
||||
&["cs", "de", "el", "es", "fr", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi", "tr"];
|
||||
|
||||
/// Crates whose error and status messages reach the status bar.
|
||||
const MESSAGE_CRATES: &[&str] = &["ui-egui", "engine", "doc", "format", "svg", "pdf", "eps", "text", "plugins", "metafile", "cad", "trace"];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2864,6 +2864,7 @@ mod combo_keyboard_tests {
|
||||
mod button_tests {
|
||||
use super::*;
|
||||
|
||||
/// [`flat_button_fit`] preserves minimum width for short labels and expands for long ones.
|
||||
#[test]
|
||||
fn flat_button_fit_expands_for_long_text() {
|
||||
let ctx = egui::Context::default();
|
||||
|
||||
Reference in New Issue
Block a user