Page MenuHomePhabricator

final class PhutilEmojiLocale
libphutil Technical Documentation (Internationalization)

A picture is worth a thousand words.

Methods

public function getLocaleCode()

PhutilLocale

Get the local identifier code, like "en_US".

PhutilEmojiLocale
This method is not documented.
Return
stringLocale identifier code.

public function getLocaleName()

PhutilLocale

Get the human-readable locale name, like "English (US)".

PhutilEmojiLocale
This method is not documented.
Return
stringHuman-readable locale name.

public function getFallbackLocaleCode()

PhutilLocale

Set a fallback locale which can be used as a default if this locale is missing translations.

For locales like "English (Great Britain)", missing translations can be sourced from "English (US)".

PhutilEmojiLocale
This method is not documented.
Return
string|nullLocale code of fallback locale, or null if there is no fallback locale.

public function selectGenderVariant($variant, $translations)
Inherited

PhutilLocale

Select a gender variant for this locale. By default, locales use a simple rule with two gender variants, listed in "<male, female>" order.

Parameters
const$variant`PhutilPerson` gender constant.
list<wild>$translationsList of variants.
Return
stringVariant for use.

public function selectPluralVariant($variant, $translations)

PhutilLocale

Select a plural variant for this locale. By default, locales use a simple rule with two plural variants, listed in "<singular, plural>" order.

PhutilEmojiLocale
This method is not documented.
Parameters
int$variantPlurality of the value.
list<wild>$translationsList of variants.
Return
stringVariant for use.

public function isSillyLocale()

PhutilLocale

Flags a locale as silly, like "English (Pirate)".

These locales are fun but disastrously inappropriate for serious businesses.

PhutilEmojiLocale
This method is not documented.
Return
boolTrue if this locale is silly.

public function isTestLocale()
Inherited

PhutilLocale

Flags a locale as a testing locale, like "English (US, ALL CAPS)". These locales are useful for translation development, but not for normal users.

Return
boolTrue if this is a locale for testing or development.

public function shouldPostProcessTranslations()
Inherited

PhutilLocale

Indicates that the translator should post-process translations in this locale by calling didTranslateString().

Doing this incurs a performance penalty, and is not useful for most languages. However, it can be used to implement test translations like "English (US, ALL CAPS)".

Return
boolTrue to postprocess strings.

public function didTranslateString($raw_pattern, $translated_pattern, $args, $result_text)
Inherited

PhutilLocale

Callback for post-processing translations.

By default, this callback is not invoked. To activate it, return true from shouldPostProcessTranslations(). Activating this callback incurs a performance penalty.

Parameters
string$raw_patternThe raw input pattern.
string$translated_patternThe selected translation pattern.
list<wild>$argsThe raw input arguments.
string$result_textThe translated string.
Return
stringPost-processed translation string.

public static function loadAllLocales()
Inherited

PhutilLocale

Load all available locales.

Return
map<string, PhutilLocale>Map from codes to locale objects.

public static function loadLocale($locale_code)
Inherited

PhutilLocale

Load a specific locale using a locale code.

Parameters
string$locale_codeLocale code.
Return
PhutilLocaleLocale object.

private static function checkLocaleFallback($map, $locale, $seen)
Inherited

PhutilLocale

Recursively check locale fallbacks for cycles.

Parameters
map<string,$mapPhutilLocale> Map of locales.
PhutilLocale$localeCurrent locale.
map<string,$seenstring> Map of visited locales.
Return
void