LOCALES.php
WIKINDX : Bibliographic Management system.
Tags
Table of Contents
Functions
- get_core_message() : string
- Translate a message from a domain
- get_message() : string
- Translate a message from a domain
- translate_message() : string
- Translate a message from a domain
- dateFormatFromString() : string
- Format dates and times for localization in numeric short format
- dateFormatFromTimeStamp() : string
- Format dates and times for localization in numeric short format
- codeISO639a1toName() : string
- Return the name of a language defined by its locale code or its ISO 639-1 (alpha-2) code.
- set_locales() : mixed
- Load the translation catalogs of the user's preferred language.
- load_locales() : mixed
- determine_locale() : string
- Determine the user's preferred language.
- determine_locale_priority_stack() : array<string|int, string>
- Determine the user's preferred language.
- getAllLocales() : array<string|int, string>
- Return a selected list of all locales recognised by Intl and usable for translation and formatting
- localetoBCP47() : string
- Return the BCP 47 code that matches the code of a locale.
- getTranslatableLocales() : mixed
- Get a list of translatable locales sorted by locale name
- searchLanguageCode() : mixed
- Return the language code matching a language name
- sort() : mixed
- Sort an array according to the current Intl locale in ascending order
- asort() : mixed
- Sort an array according to the current Intl locale in ascending order and maintain index association
- ksort() : mixed
- Sort an array according to the current Intl locale in ascending order and maintain index association
- rsort() : mixed
- Sort an array according to the current Intl locale in descending order
- arsort() : mixed
- Sort an array according to the current Intl locale in descending order and maintain index association
- krsort() : mixed
- Sort an array according to the current Intl locale in descending order and maintain index association
- messageTranslatorNeeded() : mixed
- Return a message if the project need translation contribution for the current locale
Functions
get_core_message()
Translate a message from a domain
get_core_message(string $sectionKey, string $messageKey[, mixed $messageParam = "" ]) : string
This function is mimicking dgettext().
Parameters
- $sectionKey : string
-
Section key of the catalog
- $messageKey : string
-
Message key of the catalog
- $messageParam : mixed = ""
-
Optional string or array of strings that replaces '###' in the message. Default is ""
Tags
Return values
stringget_message()
Translate a message from a domain
get_message(string $domain, string $sectionKey, string $messageKey[, mixed $messageParam = "" ]) : string
This function is mimicking dgettext().
Parameters
- $domain : string
-
Catalog domain name
- $sectionKey : string
-
Section key of the catalog
- $messageKey : string
-
Message key of the catalog
- $messageParam : mixed = ""
-
Optional string or array of strings that replaces '###' in the message. Default is ""
Tags
Return values
stringtranslate_message()
Translate a message from a domain
translate_message(string $domain, string $message) : string
This function is mimicking dgettext().
Parameters
- $domain : string
-
Catalog domain name
- $message : string
-
Message to translate
Tags
Return values
stringdateFormatFromString()
Format dates and times for localization in numeric short format
dateFormatFromString(string $datetime) : string
Use it for displaying data to the user, not formatting data for the db.
If $datetime is not parseable then its value is returned unformated.
If IntlDateFormatter instanciation fails then the date is formated with "Y-M-d H:i:s" pattern.
Parameters
- $datetime : string
-
comes in from the database in the format 'YYYY-MM-DD HH:MM:SS' e.g. 2013-01-31 15:54:55
Return values
stringdateFormatFromTimeStamp()
Format dates and times for localization in numeric short format
dateFormatFromTimeStamp(int $timestamp) : string
Use it for displaying data to the user, not formatting data for the db.
If IntlDateFormatter instanciation fails then the date is formated with "Y-M-d H:i:s" pattern.
Parameters
- $timestamp : int
Return values
stringcodeISO639a1toName()
Return the name of a language defined by its locale code or its ISO 639-1 (alpha-2) code.
codeISO639a1toName(string $codeISO) : string
Parameters
- $codeISO : string
Tags
Return values
stringset_locales()
Load the translation catalogs of the user's preferred language.
set_locales() : mixed
load_locales()
load_locales(mixed $domain, mixed $locale) : mixed
Parameters
- $domain : mixed
- $locale : mixed
determine_locale()
Determine the user's preferred language.
determine_locale([null|string $force_locale = NULL ]) : string
This function builds a language priority stack and return the first entry as the user's preferred language.
If $force_locale is passed, this function will try to use this locale first.
Parameters
- $force_locale : null|string = NULL
-
Code of a locale (format: ll[_Script][_CC])(optional, NULL by default)
Return values
stringdetermine_locale_priority_stack()
Determine the user's preferred language.
determine_locale_priority_stack([null|string $force_locale = NULL ]) : array<string|int, string>
This function builds a language priority stack. The first is the highest priority.
If $force_locale is passed, this function will try to use this locale first.
Parameters
- $force_locale : null|string = NULL
-
Code of a locale (format: ll[_Script][_CC])(optional, NULL by default)
Return values
array<string|int, string>getAllLocales()
Return a selected list of all locales recognised by Intl and usable for translation and formatting
getAllLocales([bool $sorted_by_key = FALSE ]) : array<string|int, string>
Each entry of the returned array is locale code (format: ll[_Script][_CC]) as key and its name as value [format: language (Country, Variant)].
ll is a mandatory language code CC is an optional country code variant is an optional script, money or collation code
Parameters
- $sorted_by_key : bool = FALSE
-
If TRUE, sort the table by keys instead of values
Tags
Return values
array<string|int, string>localetoBCP47()
Return the BCP 47 code that matches the code of a locale.
localetoBCP47(string $locale) : string
The BCP 47 code is used in the lang attribute of any HTML tag. The list of supported languages is simple enough to avoid having to encounter any particular case.
Parameters
- $locale : string
-
Code of a locale (format: ll[_Script][_CC])
Tags
Return values
string —If a BCP47 code is missing, return 'en'
getTranslatableLocales()
Get a list of translatable locales sorted by locale name
getTranslatableLocales(mixed $in_locale) : mixed
This is a list of locales that a translator can use to translate a text and not a list of locales currently available on the system.
Each key is a locale code and its value a displayname.
return string[]
Parameters
- $in_locale : mixed
searchLanguageCode()
Return the language code matching a language name
searchLanguageCode(mixed $name_search) : mixed
If no language code matchs the name, return FALSE.
NB: this function is slow and should not be used outside the upgrade code
return string|FALSE
Parameters
- $name_search : mixed
sort()
Sort an array according to the current Intl locale in ascending order
sort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
This function is a wrapper of collator_sort() that works as sort().
If you really need more flexibility or the full power of an Unicode sort algo, use the original function.
Parameters
- $array : array<string|int, mixed>
-
Array of strings to sort.
- $flags : int = Collator::SORT_REGULAR
-
Optional sorting type, one of the following:
- Collator::SORT_REGULAR - compare items normally (don't change types)
- Collator::SORT_NUMERIC - compare items numerically
- Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.
return bool TRUE on success, FALSE otherwise
Tags
asort()
Sort an array according to the current Intl locale in ascending order and maintain index association
asort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
This function is a wrapper of collator_asort() that works as asort().
If you really need more flexibility or the full power of an Unicode sort algo, use the original function.
Parameters
- $array : array<string|int, mixed>
-
Array of strings to sort.
- $flags : int = Collator::SORT_REGULAR
-
Optional sorting type, one of the following:
- Collator::SORT_REGULAR - compare items normally (don't change types)
- Collator::SORT_NUMERIC - compare items numerically
- Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.
return bool TRUE on success, FALSE otherwise
Tags
ksort()
Sort an array according to the current Intl locale in ascending order and maintain index association
ksort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
This function is a wrapper of Collator::compare() that works as ksort().
If you really need more flexibility or the full power of an Unicode sort algo, use the original function.
Parameters
- $array : array<string|int, mixed>
-
Array of strings to sort.
- $flags : int = Collator::SORT_REGULAR
-
Optional sorting type, one of the following:
- Collator::SORT_REGULAR - compare items normally (don't change types)
- Collator::SORT_NUMERIC - compare items numerically
- Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.
return bool TRUE on success, FALSE otherwise
Tags
rsort()
Sort an array according to the current Intl locale in descending order
rsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
This function is a wrapper of Collator::compare() that works as rsort().
If you really need more flexibility or the full power of an Unicode sort algo, use the original function.
Parameters
- $array : array<string|int, mixed>
-
Array of strings to sort.
- $flags : int = Collator::SORT_REGULAR
-
Optional sorting type, one of the following:
- Collator::SORT_REGULAR - compare items normally (don't change types)
- Collator::SORT_NUMERIC - compare items numerically
- Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.
return bool TRUE on success, FALSE otherwise
Tags
arsort()
Sort an array according to the current Intl locale in descending order and maintain index association
arsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
This function is a wrapper of Collator::compare() that works as arsort().
If you really need more flexibility or the full power of an Unicode sort algo, use the original function.
Parameters
- $array : array<string|int, mixed>
-
Array of strings to sort.
- $flags : int = Collator::SORT_REGULAR
-
Optional sorting type, one of the following:
- Collator::SORT_REGULAR - compare items normally (don't change types)
- Collator::SORT_NUMERIC - compare items numerically
- Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.
return bool TRUE on success, FALSE otherwise
Tags
krsort()
Sort an array according to the current Intl locale in descending order and maintain index association
krsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
This function is a wrapper of Collator::compare() that works as krsort().
If you really need more flexibility or the full power of an Unicode sort algo, use the original function.
Parameters
- $array : array<string|int, mixed>
-
Array of strings to sort.
- $flags : int = Collator::SORT_REGULAR
-
Optional sorting type, one of the following:
- Collator::SORT_REGULAR - compare items normally (don't change types)
- Collator::SORT_NUMERIC - compare items numerically
- Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.
return bool TRUE on success, FALSE otherwise
Tags
messageTranslatorNeeded()
Return a message if the project need translation contribution for the current locale
messageTranslatorNeeded() : mixed
return string