mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-01 22:19:10 -06:00
M14: add Vietnamese interface and date localization (#1712)
* G14: Vietnamese catalog — menus, file and shell chrome Add the Vietnamese (vi) TSV catalog header and translations for menus, File/Edit/Help chrome, clipboard and common shell labels. PhotoCraft and VectorCraft catalogs used only as translation memory when English source and context matched. ATTRIBUTION records the asset hash. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: Vietnamese catalog — forms, signatures and pages Translate form/Fill & Sign/certificate wording and page organize/rotate/ extract/split labels. Keep product and format names unchanged. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: Vietnamese catalog — comments, view, a11y and contexts Translate comments/markup, view/zoom/preferences tools, accessibility and preflight sentences, plus contextual rows (certificate, calendar, keys, scroll speed, signature pad, action wizard, @plural one-form). Co-authored-by: Cursor <cursoragent@cursor.com> * G14: Vietnamese catalog — remaining dialogs and notices Complete the Vietnamese catalog to every (context, English) key in the bundled union (2,580 entries). No unapproved English UI fallbacks remain outside the documented VI_KEEP_AS_IS list. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: restore complete Vietnamese catalog key order Replace the domain-appended catalog with the verified 2,580-entry union in stable key order so coverage matches every bundled reference key. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: register Vietnamese interface and date language Add `vi` / Tiếng Việt to LANGUAGES and DATE_LANGUAGES with plural_none and rtl false. Locale tags vi, vi-VN and vi_VN.UTF-8 resolve. Calendar uses Tháng Một / tháng Một; Fill & Sign refuses non-WinAnsi month names. Coverage tests require full command, literal, key and credits coverage. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: document Vietnamese localization Record Vietnamese at 100% catalog coverage in localization-parity and ROADMAP, list Tiếng Việt in Preferences/docs, and note the G14 catalog in the progress log. Engine/OS details, document contents, filenames, CLI/MCP and external help remain out of scope by design. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: use ASCII > in Vietnamese preference paths Inter lacks U+25B8 (▸). Match other Latin catalogs and write preference paths as "Tùy chọn > …" so the glyph coverage test stays green. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: finalize Vietnamese terminology and current coverage Disambiguate theme Appearance (Giao diện) from object look (Diện mạo), normalize form Field to Trường, make redaction apply wording permanent, use numeric calendar months, close the GoToR/digital-ID key gap, and pin regression assertions. Refresh the vi.tsv attribution hash. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: align localization docs with Vietnamese coverage Recompute the twelve-language mean (≈59% → ≈68%), document 23 interface languages, and remove stale claims that Vietnamese is missing. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: cover Wayland title-bar strings in Vietnamese Translate Minimize/Maximize/Restore and the system title-bar preference added on upstream main, and refresh the catalog attribution hash and counts. Co-authored-by: Cursor <cursoragent@cursor.com> * G14: correct current union key count in localization docs Co-authored-by: Cursor <cursoragent@cursor.com> * G14: prepare Vietnamese localization for review Trim the vi.tsv header to maintainer-oriented notes, record native-speaker community review in attribution and localization docs, and refresh the weighted readiness arithmetic (localization ≈68% → ≈50%). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: DUY Tran Nhat (SAE-KIDS) <duytn@sanancorp.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
DUY Tran Nhat
parent
00957b9f21
commit
db5b9b4364
@@ -56,7 +56,7 @@ const AR_DAYS: [&str; 7] = ["الأحد", "الاثنين", "الثلاثاء",
|
||||
|
||||
/// The languages month and weekday names can be written in (Preferences ▸ Date format ▸ Language):
|
||||
/// the interface languages, in the same order and with the same names.
|
||||
pub static DATE_LANGUAGES: [DateLanguage; 22] = [
|
||||
pub static DATE_LANGUAGES: [DateLanguage; 23] = [
|
||||
DateLanguage {
|
||||
code: "en",
|
||||
name: "English",
|
||||
@@ -360,6 +360,44 @@ pub static DATE_LANGUAGES: [DateLanguage; 22] = [
|
||||
days: ["sekmadienis", "pirmadienis", "antradienis", "trečiadienis", "ketvirtadienis", "penktadienis", "šeštadienis"],
|
||||
days_short: ["sk", "pr", "an", "tr", "kt", "pn", "št"],
|
||||
},
|
||||
// Vietnamese: numeric month forms (`tháng 1` with a day, `Tháng 1` standing alone).
|
||||
// Fill & Sign still refuses any format whose final text fails the existing WinAnsi check
|
||||
// (for example weekday names); `dd.mm.yyyy` remains writable.
|
||||
DateLanguage {
|
||||
code: "vi",
|
||||
name: "Tiếng Việt",
|
||||
months: [
|
||||
"Tháng 1",
|
||||
"Tháng 2",
|
||||
"Tháng 3",
|
||||
"Tháng 4",
|
||||
"Tháng 5",
|
||||
"Tháng 6",
|
||||
"Tháng 7",
|
||||
"Tháng 8",
|
||||
"Tháng 9",
|
||||
"Tháng 10",
|
||||
"Tháng 11",
|
||||
"Tháng 12",
|
||||
],
|
||||
months_with_day: Some([
|
||||
"tháng 1",
|
||||
"tháng 2",
|
||||
"tháng 3",
|
||||
"tháng 4",
|
||||
"tháng 5",
|
||||
"tháng 6",
|
||||
"tháng 7",
|
||||
"tháng 8",
|
||||
"tháng 9",
|
||||
"tháng 10",
|
||||
"tháng 11",
|
||||
"tháng 12",
|
||||
]),
|
||||
months_short: ["Thg 1", "Thg 2", "Thg 3", "Thg 4", "Thg 5", "Thg 6", "Thg 7", "Thg 8", "Thg 9", "Thg 10", "Thg 11", "Thg 12"],
|
||||
days: ["Chủ Nhật", "Thứ Hai", "Thứ Ba", "Thứ Tư", "Thứ Năm", "Thứ Sáu", "Thứ Bảy"],
|
||||
days_short: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"],
|
||||
},
|
||||
];
|
||||
|
||||
/// The date language for `code` (any case), or `None` when there's none.
|
||||
@@ -683,6 +721,25 @@ mod tests {
|
||||
assert_eq!(s.date_language(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vietnamese_month_and_weekday_names() {
|
||||
let mut s = Session::new().with_clock(|| 1_700_000_000);
|
||||
s.set_date_language(Some("vi")).unwrap();
|
||||
assert_eq!(s.date_language(), Some("vi"));
|
||||
s.set_date_format("d mmmm yyyy").unwrap();
|
||||
assert_eq!(s.today_text(None, None).as_deref(), Ok("14 tháng 11 2023"));
|
||||
s.set_date_format("mmmm yyyy").unwrap();
|
||||
assert_eq!(s.today_text(None, None).as_deref(), Ok("Tháng 11 2023"));
|
||||
s.set_date_format("ddd, d mmm").unwrap();
|
||||
assert_eq!(s.today_text(None, None).as_deref(), Ok("T3, 14 Thg 11"));
|
||||
// Encoding follows the spelled text: `14 tháng 11 2023` is WinAnsi-representable;
|
||||
// a weekday name such as `Thứ Ba` is not, so Fill & Sign refuses that format.
|
||||
assert_eq!(s.today_text_for_pdf(Some("d mmmm yyyy"), Some("vi")).as_deref(), Ok("14 tháng 11 2023"));
|
||||
let e = s.today_text_for_pdf(Some("dddd d mmmm yyyy"), Some("vi")).unwrap_err();
|
||||
assert!(e.contains("can't be written into the PDF yet") && e.contains("dd.mm.yyyy"), "{e}");
|
||||
assert!(s.today_text_for_pdf(Some("dd.mm.yyyy"), Some("vi")).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dates_the_pdf_cannot_hold_are_refused_not_damaged() {
|
||||
assert_eq!(unwritable("8. října 2026"), "ř");
|
||||
|
||||
Reference in New Issue
Block a user