Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Fix Traditional Chinese label generator crash (#1728)

Aditya Raj Singh0ad87b3e8703
diff --git a/frontend/locales/zh-TW.json b/frontend/locales/zh-TW.json
index b51c94f8..297ad6c0 100644
--- a/frontend/locales/zh-TW.json
+++ b/frontend/locales/zh-TW.json
@@ -800,8 +800,8 @@
"replace_homebox_behavior_show_homebox": "顯示「HomeBox」",
"replace_homebox_text": "自訂文字",
"skip_first_labels": "略過起始標籤數",
- "tip_1": "此功能預設使用<a href=\"https://www.avery.com/templates/5260\">Avery 5260標籤紙</a>。\n若您使用不同標籤紙,\n請調整以下設定以符合您的標籤尺寸。",
- "tip_2": "調整設定時,請注意預設單位為英寸(in)。\n在設定 Avery 5260 標籤紙時我們發現使用官方建議尺寸,實際列印仍無法完全對齊標籤格,\n<b>因此建議預留一些測試與調整的空間。</b>",
+ "tip_1": "此功能預設使用'<a href=\"https://www.avery.com/templates/5260\">'Avery 5260標籤紙'</a>'。\n若您使用不同標籤紙,\n請調整以下設定以符合您的標籤尺寸。",
+ "tip_2": "調整設定時,請注意預設單位為英寸(in)。\n在設定 Avery 5260 標籤紙時我們發現使用官方建議尺寸,實際列印仍無法完全對齊標籤格,\n'<b>'因此建議預留一些測試與調整的空間。'</b>'",
"tip_3": "列印時請注意:\n'<ol><li>'將白邊設定為「0」或「無」'</li><li>'將放大倍率設定為100%'</li><li>'停用雙面列印'</li><li>'先列印一張測試確認後再列印多張'</li></ol>'",
"tips": "小技巧",
"title": "標籤產生器",
diff --git a/frontend/locales/zh-TW.test.ts b/frontend/locales/zh-TW.test.ts
new file mode 100644
index 00000000..7436bd54
--- /dev/null
+++ b/frontend/locales/zh-TW.test.ts
@@ -0,0 +1,16 @@
+import { IntlMessageFormat } from "intl-messageformat";
+import { expect, test } from "vitest";
+
+import messages from "./zh-TW.json";
+
+test("label generator tips are valid ICU messages", () => {
+ for (const message of [
+ messages.reports.label_generator.tip_1,
+ messages.reports.label_generator.tip_2,
+ messages.reports.label_generator.tip_3,
+ ]) {
+ expect(() =>
+ new IntlMessageFormat(message, "zh-TW").format(),
+ ).not.toThrow();
+ }
+});