diff options
Diffstat (limited to 'src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml')
-rw-r--r-- | src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml b/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml new file mode 100644 index 0000000..8b839f6 --- /dev/null +++ b/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE supplementalData SYSTEM "http://www.unicode.org/cldr/dtd/1.5/ldmlSupplemental.dtd"> +<supplementalData> + <transforms> + <transform source="Latin" target="NumericPinyin" direction="both"> + <comment># According to the pinyin definitions I've been able to find:</comment> + <comment># 'a', 'e' are the preferred bases</comment> + <comment># otherwise 'o'</comment> + <comment># otherwise last vowel</comment> + <comment># The trailing form of syllables are the following:</comment> + <comment># "a", "ai", "ao", "an", "ang",</comment> + <comment># "o", "ou", "ong",</comment> + <comment># "e", "ei", "er", "en", "eng",</comment> + <comment># "i", "ia", "iao", "ie", "iu", "ian", "in", "iang", "ing", "iong",</comment> + <comment># "u", "ua", "uo", "uai", "ui", "uan", "un", "uang", "ueng",</comment> + <comment># "ü", "üe", "üan", "ün"</comment> + <comment># so the letters the tone will 'hop' are:</comment> + <tRule>::NFD (NFC);</tRule> + <tRule>$tone = [̄́̌̀̆] ;</tRule> + <comment># Move the tone to the end of a syllable, and convert to number</comment> + <tRule>e {($tone) r} → r &tone-digit($1);</tRule> + <tRule>($tone) ( [i o n u {o n} {n g}]) → $2 &tone-digit($1);</tRule> + <tRule>($tone) → &tone-digit($1);</tRule> + <comment># The following backs up until it finds the right vowel, then deposits the tone</comment> + <tRule>$vowel = [aAeEiIoOuUüÜ {ü} {Ü} ];</tRule> + <tRule>$consonant = [[a-z A-Z] - [$vowel]];</tRule> + <tRule>$digit = [1-5];</tRule> + <tRule>$1 &digit-tone($3) $2 ← ([aAeE]) ($vowel* $consonant*) ($digit);</tRule> + <tRule>$1 &digit-tone($3) $2 ← ([oO]) ([$vowel-[aeAE]]* $consonant*) ($digit);</tRule> + <tRule>$1 &digit-tone($3) $2 ← ($vowel) ($consonant*) ($digit);</tRule> + <tRule>&digit-tone($1) ← [:letter:] {($digit)};</tRule> + <tRule>::NFC (NFD);</tRule> + </transform> + </transforms> +</supplementalData> + |