Chinese (Taiwan) 中文(台灣) zh-TW

Lokalized supports cardinality, cardinality range, and ordinality rules for Chinese (Taiwan).

Additional modeled concepts for Chinese (Taiwan): classifiers and counters.

Cardinalities

All numbers use CARDINALITY_OTHER; no value selects a different form.

Example: 2 天.

Cardinality Ranges

Every range resolves to CARDINALITY_OTHER because every endpoint is CARDINALITY_OTHER. Cardinality.forRange(...) therefore cannot select a different form.

Ordinalities

All ordinal numbers use ORDINALITY_OTHER; no value selects a different form.

Example: 在第 2 個路口右轉。.

Language-Specific Examples

These examples show how Lokalized models grammatical choices and translation behavior that commonly affect Chinese (Taiwan) application copy. Each example identifies the Lokalized language forms and other library features it uses.

Classifier and noun phrases

Passing Classifier.GENERAL, Classifier.BOUND, or Classifier.MACHINE selects the complete Traditional Chinese classifier-and-noun phrase that follows the application-supplied count: 個蘋果 for apples, 本書 for books, or 台電腦 for computers.

Language references: Ohio State University - Plurals and classifiers in Chinese, National Taiwan Normal University Mandarin Training Center - 台 for machines and appliances

Lokalized forms used: Classifier

Sample localized strings file
zh-TW.json Localized Strings File (Chinese (Taiwan))
{
  "I bought {{count}} items.": {
    "translation": "我買了{{count}}{{item}}。",
    "placeholders": {
      "item": {
        "value": "classifier",
        "translations": {
          "CLASSIFIER_GENERAL": "個蘋果",
          "CLASSIFIER_BOUND": "本書",
          "CLASSIFIER_MACHINE": "台電腦"
        }
      }
    }
  }
}
Usage and expected results
Locale locale = Locale.forLanguageTag("zh-TW");

Strings strings = Strings.withFallbackLocale(locale)
  .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings")))
  .localeSupplier((matcher) -> matcher.bestMatchFor(locale))
  .build();

assertEquals("我買了3個蘋果。", strings.get(
  "I bought {{count}} items.", Map.of("count", 3, "classifier", Classifier.GENERAL)
));

assertEquals("我買了2本書。", strings.get(
  "I bought {{count}} items.", Map.of("count", 2, "classifier", Classifier.BOUND)
));

assertEquals("我買了1台電腦。", strings.get(
  "I bought {{count}} items.", Map.of("count", 1, "classifier", Classifier.MACHINE)
));

Addendum: Language Form Rules

The language form expressions above are specified by Unicode Technical Standard #35 and use the following notation:

  • n absolute value of the source number (integer and decimals)
  • i integer digits of n
  • v number of visible fraction digits in n, with trailing zeros
  • w number of visible fraction digits in n, without trailing zeros
  • f visible fractional digits in n, with trailing zeros
  • t visible fractional digits in n, without trailing zeros
  • c/e compact decimal exponent operands used by some CLDR compact-number rules