Changeset View
Changeset View
Standalone View
Standalone View
src/internationalization/PhutilLocale.php
| Show All 33 Lines | abstract class PhutilLocale extends Phobject { | ||||
| * no fallback locale. | * no fallback locale. | ||||
| */ | */ | ||||
| public function getFallbackLocaleCode() { | public function getFallbackLocaleCode() { | ||||
| return null; | return null; | ||||
| } | } | ||||
| /** | /** | ||||
| * Select a gender variant for this locale. By default, locales use a simple | |||||
| * rule with two gender variants, listed in "<male, female>" order. | |||||
| * | |||||
| * @param const `PhutilPerson` gender constant. | |||||
| * @param list<wild> List of variants. | |||||
| * @return string Variant for use. | |||||
| */ | |||||
| public function selectGenderVariant($variant, array $translations) { | |||||
| if ($variant == PhutilPerson::SEX_FEMALE) { | |||||
| return end($translations); | |||||
| } else { | |||||
| return reset($translations); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Select a plural variant for this locale. By default, locales use a simple | |||||
| * rule with two plural variants, listed in "<singular, plural>" order. | |||||
| * | |||||
| * @param int Plurality of the value. | |||||
| * @param list<wild> List of variants. | |||||
| * @return string Variant for use. | |||||
| */ | |||||
| public function selectPluralVariant($variant, array $translations) { | |||||
| if ($variant == 1) { | |||||
| return reset($translations); | |||||
| } else { | |||||
| return end($translations); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Flags a locale as silly, like "English (Pirate)". | * Flags a locale as silly, like "English (Pirate)". | ||||
| * | * | ||||
| * These locales are fun but disastrously inappropriate for serious | * These locales are fun but disastrously inappropriate for serious | ||||
| * businesses. | * businesses. | ||||
| * | * | ||||
| * @return bool True if this locale is silly. | * @return bool True if this locale is silly. | ||||
| */ | */ | ||||
| public function isSillyLocale() { | public function isSillyLocale() { | ||||
| ▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines | |||||