Factory¶
-
class
OC\L10N\Factory¶ - A factory that generates language instances
Source: lib/private/L10N/Factory.php#50 Implements: OCP\L10N\IFactory
Constants¶
-
COMMON_LANGUAGE_CODES = [en, es, fr, de, de_DE, ja, ar, ru, nl, it, pt_BR, pt_PT, da, fi_FI, nb_NO, sv, tr, zh_CN, ko] Source: lib/private/L10N/Factory.php#81
Properties¶
-
protected static property
OC\L10N\Factory::$requestLanguage¶ Source: lib/private/L10N/Factory.php#53 Type: string
-
protected static property
OC\L10N\Factory::$instances¶ - cached instances
Source: lib/private/L10N/Factory.php#59 Type: array Structure: Lang => App => \OCP\IL10N
-
protected static property
OC\L10N\Factory::$availableLanguages¶ Source: lib/private/L10N/Factory.php#64 Type: array Structure: App => string[]
-
protected static property
OC\L10N\Factory::$localeCache¶ Source: lib/private/L10N/Factory.php#69 Type: array
-
protected static property
OC\L10N\Factory::$availableLocales¶ Source: lib/private/L10N/Factory.php#74 Type: array
-
protected static property
OC\L10N\Factory::$pluralFunctions¶ Source: lib/private/L10N/Factory.php#79 Type: array Structure: string => callable
-
protected static property
OC\L10N\Factory::$config¶ Source: lib/private/L10N/Factory.php#87 Type: \OCP\IConfig
-
protected static property
OC\L10N\Factory::$request¶ Source: lib/private/L10N/Factory.php#90 Type: \OCP\IRequest
-
protected static property
OC\L10N\Factory::$userSession¶ Source: lib/private/L10N/Factory.php#93 Type: \OCP\IUserSession
-
protected static property
OC\L10N\Factory::$serverRoot¶ Source: lib/private/L10N/Factory.php#96 Type: string
Methods¶
-
public
OC\L10N\Factory::__construct($config, $request, $userSession, $serverRoot)¶ Source: Parameters: - $config (
OCP\IConfig) - $request (
OCP\IRequest) - $userSession (
OCP\IUserSession) - $serverRoot (string)
- $config (
-
public
OC\L10N\Factory::get($app, $lang=null, $locale=null)¶ - Get a language instance
Source: Parameters: - $app (string)
- $lang (string | null)
- $locale (string | null)
Returns:
-
public
OC\L10N\Factory::findLanguage($app=null)¶ - Find the best language
Source: Parameters: - $app (string | null) App id or null for core
Returns: string language If nothing works it returns ‘en’
-
public
OC\L10N\Factory::findLocale($lang=null)¶ - find the best locale
Source: Parameters: - $lang (string)
Returns: null | string
-
public
OC\L10N\Factory::findLanguageFromLocale($app=core, $locale=null)¶ - find the matching lang from the locale
Source: Parameters: - $app (string)
- $locale (string)
Returns: null | string
-
public
OC\L10N\Factory::findAvailableLanguages($app=null)¶ - Find all available languages for an app
Source: Parameters: - $app (string | null) App id or null for core
Returns: array an array of available languages
-
public
OC\L10N\Factory::findAvailableLocales()¶ Source: lib/private/L10N/Factory.php#334 Returns: array | mixed
-
public
OC\L10N\Factory::languageExists($app, $lang)¶ Source: Parameters: - $app (string | null) App id or null for core
- $lang (string)
Returns: bool
-
public
OC\L10N\Factory::getLanguageIterator($user=null)¶ Source: lib/private/L10N/Factory.php#359
-
public
OC\L10N\Factory::getUserLanguage($user=null)¶ - Return the language to use when sending something to a user
Source: Parameters: - $user (
OCP\IUser| null)
Returns: string
Since: 20.0.0
- $user (
-
public
OC\L10N\Factory::localeExists($locale)¶ Source: Parameters: - $locale (string)
Returns: bool
-
protected
OC\L10N\Factory::respectDefaultLanguage($app, $lang)¶ - if default language is set to de_DE (formal German) this should bepreferred to ‘de’ (non-formal German) if possible
Source: Parameters: - $app (string | null)
- $lang (string)
Returns: string
-
public
OC\L10N\Factory::getL10nFilesForApp($app, $lang)¶ Source: lib/private/L10N/Factory.php#500
-
protected
OC\L10N\Factory::findL10nDir($app=null)¶ - find the l10n directory
Source: Parameters: - $app (string) App id or empty string for core
Returns: string directory
-
public
OC\L10N\Factory::createPluralFunction($string)¶ - Creates a function from the plural stringParts of the code is copied from Habari:
Source: Parameters: - $string (string)
Returns: string
-
public
OC\L10N\Factory::getLanguages()¶ - returns the common language and other languages in anassociative array
Source: lib/private/L10N/Factory.php#616 Returns: array