CRM_Core_I18n
class CRM_Core_I18n
Constants
NONE |
Constants for communication preferences. |
AUTO |
Constants for communication preferences. |
Methods
A locale-based constructor that shouldn't be called from outside of this class (use singleton() instead).
Returns whether gettext is running natively or using PHP-Gettext.
Set native locale for getText.
Set getText locale.
Return languages available in this instance of CiviCRM.
Replace arguments in a string with their values. Arguments are represented by % followed by their number.
Get the directory for l10n resources.
Smarty block function, provides gettext support for smarty.
Lookup the raw translation of a string (without any extra escaping or interpolation).
Translate a string to the current locale.
Localize (destructively) array values.
Localize (destructively) array elements with keys of 'title'.
Binds a gettext domain, wrapper over bindtextdomain().
Is the CiviCRM in multilingual mode.
Is the language written "right-to-left"?
Change the processing language without changing the current user language
Static instance provider - return the instance for the current locale.
Set the LC_TIME locale if it's not set already (for a given language choice).
Get the default language for contacts where no language is provided.
Get the current locale
Details
at line 74
CRM_Core_I18n
__construct(string $locale)
A locale-based constructor that shouldn't be called from outside of this class (use singleton() instead).
at line 96
bool
isNative()
Returns whether gettext is running natively or using PHP-Gettext.
at line 105
protected
setNativeGettextLocale(string $locale)
Set native locale for getText.
at line 129
protected
setPhpGettextLocale(string $locale)
Set getText locale.
at line 159
static array
languages(bool $justEnabled = FALSE)
Return languages available in this instance of CiviCRM.
at line 215
string
strarg(string $str)
Replace arguments in a string with their values. Arguments are represented by % followed by their number.
at line 237
static string
getResourceDir()
Get the directory for l10n resources.
at line 270
string
crm_translate(string $text, array $params = array())
Smarty block function, provides gettext support for smarty.
The block content is the text that should be translated.
Any parameter that is sent to the function will be represented as %n in the translation text, where n is 1 for the first parameter. The following parameters are reserved: - escape - sets escape mode: - 'html' for HTML escaping, this is the default. - 'js' for javascript escaping. - 'no'/'off'/0 - turns off escaping - plural - The plural version of the text (2nd parameter of ngettext()) - count - The item count for plural mode (3rd parameter of ngettext()) - context - gettext context of that string (for homonym handling)
at line 366
protected string
crm_translate_raw(string $text, string|NULL $domain, int|NULL $count, string $plural, string $context)
Lookup the raw translation of a string (without any extra escaping or interpolation).
at line 456
string
translate(string $string)
Translate a string to the current locale.
at line 468
localizeArray(array $array, array $params = array())
Localize (destructively) array values.
at line 491
localizeTitles(array $array)
Localize (destructively) array elements with keys of 'title'.
at line 512
Bool
setGettextDomain($key)
Binds a gettext domain, wrapper over bindtextdomain().
at line 567
static Bool
isMultilingual()
Is the CiviCRM in multilingual mode.
at line 582
static Bool
isLanguageRTL($language)
Is the language written "right-to-left"?
at line 596
setLocale($locale)
Change the processing language without changing the current user language
at line 621
static CRM_Core_I18n
singleton()
Static instance provider - return the instance for the current locale.
at line 638
static string
setLcTime()
Set the LC_TIME locale if it's not set already (for a given language choice).
at line 660
static string
getContactDefaultLanguage()
Get the default language for contacts where no language is provided.
Note that NULL is a valid option so be careful with checking for empty etc.
NULL would mean 'we don't know & we don't want to hazard a guess'.
at line 683
static string
getLocale()
Get the current locale