Add Korean translation (#234)
* Create ko.json * Update ko.json * Update i18n.rs * Fonts: add a Hangul fallback so Korean doesn't render as boxes Only the first CJK font found was loaded, and on Windows and macOS that is a Japanese font without Hangul (Meiryo, Hiragino). Load the first readable font of each group: the existing CJK list, then Malgun Gothic (Windows), Apple SD Gothic Neo (macOS) or Nanum Gothic (Linux). Also rustfmt the Korean catalog test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT --------- Co-authored-by: bherbruck <brennen.herbruck@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
3 files changed
+377
-11
No files matched your search
@@ -34,7 +34,8 @@ impl Catalog {
|
||||
static ENGLISH: Catalog = Catalog::new("en", "English", include_str!("locales/en.json"));
|
||||
static JAPANESE: Catalog = Catalog::new("ja", "日本語", include_str!("locales/ja.json"));
|
||||
static GERMAN: Catalog = Catalog::new("de", "Deutsch", include_str!("locales/de.json"));
|
||||
pub const LOCALES: &[&Catalog] = &[&ENGLISH, &JAPANESE, &GERMAN];
|
||||
static KOREAN: Catalog = Catalog::new("ko", "한국어", include_str!("locales/ko.json"));
|
||||
pub const LOCALES: &[&Catalog] = &[&ENGLISH, &JAPANESE, &GERMAN, &KOREAN];
|
||||
|
||||
pub fn is_supported(id: &str) -> bool {
|
||||
LOCALES.iter().any(|catalog| catalog.id == id)
|
||||
@@ -250,6 +251,27 @@ mod tests {
|
||||
assert_eq!(Locale::for_language("en").dynamic("Sketch1"), "Sketch1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn korean_catalog_translates_keys_labels_and_browser_patterns() {
|
||||
let ko = Locale::for_language("ko");
|
||||
assert_eq!(ko.name(), "한국어");
|
||||
assert!(is_supported("ko"));
|
||||
assert_eq!(ko.text("ui.preferences"), "환경 설정");
|
||||
assert_eq!(ko.label("Extrude"), "돌출");
|
||||
assert_eq!(ko.label("CREATE SKETCH"), "스케치 만들기");
|
||||
assert_eq!(ko.label("NonExistentKey"), "NonExistentKey");
|
||||
assert_eq!(ko.format("document.save_changes", &[("name", "My {design}")]), "My {design}의 변경 사항을 저장하시겠습니까?");
|
||||
assert_eq!(ko.format("dialog.selected_count", &[("count", "2")]), "↖ 2개 선택됨");
|
||||
assert_eq!(ko.dynamic("Sketch1"), "스케치1");
|
||||
assert_eq!(ko.dynamic("Body2"), "바디2");
|
||||
assert_eq!(ko.dynamic("Component12"), "컴포넌트12");
|
||||
assert_eq!(ko.dynamic("Units: mm"), "단위: mm");
|
||||
assert_eq!(ko.dynamic("Precision: 3"), "정밀도: 3");
|
||||
assert_eq!(ko.dynamic("Parameters (5)"), "매개변수 (5)");
|
||||
assert_eq!(ko.dynamic("4 degrees of freedom"), "자유도 4개");
|
||||
assert_eq!(ko.dynamic("Sketch of bracket"), "Sketch of bracket");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn render_scopes_restore_the_previous_language() {
|
||||
let _english = scope("en");
|
||||
|
||||
Reference in new issue
Block a user