Changeset View
Changeset View
Standalone View
Standalone View
src/internationalization/PhutilTranslator.php
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | private function chooseVariant(array $translations, $variant) { | ||||
| } | } | ||||
| // TODO: Move these into PhutilLocale if benchmarks show we aren't | // TODO: Move these into PhutilLocale if benchmarks show we aren't | ||||
| // eating too much of a performance cost. | // eating too much of a performance cost. | ||||
| switch ($this->localeCode) { | switch ($this->localeCode) { | ||||
| case 'en_US': | case 'en_US': | ||||
| case 'en_GB': | case 'en_GB': | ||||
| case 'es_ES': | |||||
| case 'en_W*': | case 'en_W*': | ||||
| case 'en_P*': | case 'en_P*': | ||||
| case 'en_R*': | case 'en_R*': | ||||
| case 'en_A*': | case 'en_A*': | ||||
| list($singular, $plural) = $translations; | list($singular, $plural) = $translations; | ||||
| if ($variant == 1) { | if ($variant == 1) { | ||||
| return $singular; | return $singular; | ||||
| } | } | ||||
| Show All 20 Lines | switch ($this->localeCode) { | ||||
| case 'ko_KR': | case 'ko_KR': | ||||
| list($singular, $plural) = $translations; | list($singular, $plural) = $translations; | ||||
| if ($variant == 1) { | if ($variant == 1) { | ||||
| return $singular; | return $singular; | ||||
| } | } | ||||
| return $plural; | return $plural; | ||||
| default: | default: | ||||
| throw new Exception(pht("Unknown language '%s'.", $this->language)); | throw new Exception(pht("Unknown locale '%s'.", $this->localeCode)); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Translate date formatted by `$date->format()`. | * Translate date formatted by `$date->format()`. | ||||
| * | * | ||||
| * @param string Format accepted by `DateTime::format()`. | * @param string Format accepted by `DateTime::format()`. | ||||
| * @param DateTime | * @param DateTime | ||||
| ▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines | |||||