IFactory
Tags
Table of Contents
- createPluralFunction() : string
- Creates a function from the plural string
- findAvailableLanguages() : string[]
- Find all available languages for an app
- findAvailableLocales() : array
- findLanguage() : string
- Find the best language
- findLanguageFromLocale() : null|string
- find the matching lang from the locale
- findLocale() : string
- get() : IL10N
- Get a language instance
- getLanguageIterator() : ILanguageIterator
- iterate through language settings (if provided) in this order: 1. returns the forced language or: 2. if applicable, the trunk of 1 (e.g. "fu" instead of "fu_BAR" 3. returns the user language or: 4. if applicable, the trunk of 3 5. returns the system default language or: 6. if applicable, the trunk of 5 7+∞. returns 'en'
- languageExists() : bool
- localeExists() : bool
Methods
createPluralFunction()
Creates a function from the plural string
public
createPluralFunction(string $string) : string
Parameters
- $string : string
Tags
Return values
string —Unique function name
findAvailableLanguages()
Find all available languages for an app
public
findAvailableLanguages([string|null $app = null ]) : string[]
Parameters
- $app : string|null = null
-
App id or null for core
Tags
Return values
string[] —an array of available languages
findAvailableLocales()
public
findAvailableLocales() : array
Tags
Return values
array —an array of available
findLanguage()
Find the best language
public
findLanguage([string|null $app = null ]) : string
Parameters
- $app : string|null = null
-
App id or null for core
Tags
Return values
string —language If nothing works it returns 'en'
findLanguageFromLocale()
find the matching lang from the locale
public
findLanguageFromLocale([string $app = 'core' ][, string $locale = null ]) : null|string
Parameters
- $app : string = 'core'
- $locale : string = null
Tags
Return values
null|string —findLocale()
public
findLocale([string|null $lang = null ]) : string
Parameters
- $lang : string|null = null
-
user language as default locale
Tags
Return values
string —locale If nothing works it returns 'en_US'
get()
Get a language instance
public
get(string $app[, string|null $lang = null ][, string|null $locale = null ]) : IL10N
Parameters
- $app : string
- $lang : string|null = null
- $locale : string|null = null
Tags
Return values
IL10N —getLanguageIterator()
iterate through language settings (if provided) in this order: 1. returns the forced language or: 2. if applicable, the trunk of 1 (e.g. "fu" instead of "fu_BAR" 3. returns the user language or: 4. if applicable, the trunk of 3 5. returns the system default language or: 6. if applicable, the trunk of 5 7+∞. returns 'en'
public
getLanguageIterator([IUser $user = null ]) : ILanguageIterator
Hint: in most cases findLanguage() suits you fine
Parameters
- $user : IUser = null
Tags
Return values
ILanguageIterator —languageExists()
public
languageExists(string|null $app, string $lang) : bool
Parameters
- $app : string|null
-
App id or null for core
- $lang : string
Tags
Return values
bool —localeExists()
public
localeExists(string $locale) : bool
Parameters
- $locale : string