IFactory

interface OCP\L10N\IFactory
Implemented by:OC\L10N\Factory
Source:lib/public/L10N/IFactory.php#37

Methods

public OCP\L10N\IFactory::get($app, $lang=null, $locale=null)
Get a language instance
Source:

lib/public/L10N/IFactory.php#47

Parameters:
  • $app (string)
  • $lang (string | null)
  • $locale (string | null)
Returns:

\OCP\IL10N

Since:

8.2.0

public OCP\L10N\IFactory::findLanguage($app=null)
Find the best language
Source:

lib/public/L10N/IFactory.php#56

Parameters:
  • $app (string | null) App id or null for core
Returns:

string language If nothing works it returns ‘en’

Since:

9.0.0

public OCP\L10N\IFactory::findLocale($lang=null)
Source:

lib/public/L10N/IFactory.php#63

Parameters:
  • $lang (string | null) user language as default locale
Returns:

string locale If nothing works it returns ‘en_US’

Since:

14.0.0

public OCP\L10N\IFactory::findLanguageFromLocale($app=core, $locale=null)
find the matching lang from the locale
Source:

lib/public/L10N/IFactory.php#73

Parameters:
  • $app (string)
  • $locale (string)
Returns:

null | string

Since:

14.0.1

public OCP\L10N\IFactory::findAvailableLanguages($app=null)
Find all available languages for an app
Source:

lib/public/L10N/IFactory.php#82

Parameters:
  • $app (string | null) App id or null for core
Returns:

string[] an array of available languages

Since:

9.0.0

public OCP\L10N\IFactory::findAvailableLocales()
Source:lib/public/L10N/IFactory.php#88
Returns:array an array of available
Since:14.0.0
public OCP\L10N\IFactory::languageExists($app, $lang)
Source:

lib/public/L10N/IFactory.php#96

Parameters:
  • $app (string | null) App id or null for core
  • $lang (string)
Returns:

bool

Since:

9.0.0

public OCP\L10N\IFactory::localeExists($locale)
Source:

lib/public/L10N/IFactory.php#103

Parameters:
  • $locale (string)
Returns:

bool

Since:

14.0.0

public OCP\L10N\IFactory::createPluralFunction($string)
Creates a function from the plural string
Source:

lib/public/L10N/IFactory.php#112

Parameters:
  • $string (string)
Returns:

string Unique function name

Since:

14.0.0

public OCP\L10N\IFactory::getLanguageIterator($user=null)
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’
Hint: in most cases findLanguage() suits you fine
Source:lib/public/L10N/IFactory.php#128
Since:14.0.0
public OCP\L10N\IFactory::getUserLanguage($user=null)
Return the language to use when sending something to a user
Source:

lib/public/L10N/IFactory.php#137

Parameters:
Returns:

string

Since:

20.0.0