L10N

class OC\L10N\L10N
Source:lib/private/L10N/L10N.php#37
Implements:OCP\IL10N

Properties

protected static property OC\L10N\L10N::$factory
Source:lib/private/L10N/L10N.php#40
Type:\OCP\L10N\IFactory
protected static property OC\L10N\L10N::$app
Source:lib/private/L10N/L10N.php#43
Type:string App of this object
protected static property OC\L10N\L10N::$lang
Source:lib/private/L10N/L10N.php#46
Type:string Language of this object
protected static property OC\L10N\L10N::$locale
Source:lib/private/L10N/L10N.php#49
Type:string Locale of this object

Methods

public OC\L10N\L10N::__construct($factory, $app, $lang, $locale, $files)
Source:

lib/private/L10N/L10N.php#64

Parameters:
  • $factory (OCP\L10N\IFactory)
  • $app (string)
  • $lang (string)
  • $locale (string)
  • $files (array)
public OC\L10N\L10N::getLanguageCode()
The code (en, de, .
..) of the language that is used for this instance
Source:lib/private/L10N/L10N.php#80
Returns:string language
public OC\L10N\L10N::getLocaleCode()
The code (en_US, fr_CA, .
..) of the locale that is used for this instance
Source:lib/private/L10N/L10N.php#89
Returns:string locale
public OC\L10N\L10N::t($text, $parameters=[])
Translating
Source:

lib/private/L10N/L10N.php#102

Parameters:
  • $text (string) The text we need a translation for
  • $parameters (array | string) default:array() Parameters for sprintf
Returns:

string Translation or the same text

Returns the translation. If no translation is found, $text will be returned.

public OC\L10N\L10N::n($text_singular, $text_plural, $count, $parameters=[])
Translating
Source:

lib/private/L10N/L10N.php#125

Parameters:
  • $text_singular (string) the string to translate for exactly one object
  • $text_plural (string) the string to translate for n objects
  • $count (int) Number of objects
  • $parameters (array) default:array() Parameters for sprintf
Returns:

string Translation or the same text

Returns the translation. If no translation is found, $text will be returned. %n will be replaced with the number of objects.

The correct plural is determined by the plural_forms-function provided by the po file.

public OC\L10N\L10N::l($type, $data=null, $options=[])
Localization
Source:

lib/private/L10N/L10N.php#160

Parameters:
  • $type (string) Type of localization
  • $data (DateTime | int | string) parameters for this localization
  • $options (array)
Returns:

string | int | bool Returns the localized data.

Implemented types:
- date

- Creates a date - params: timestamp (int/string)

- datetime

- Creates date and time - params: timestamp (int/string)

- time

- Creates a time - params: timestamp (int/string)

- firstday: Returns the first day of the week (0 sunday - 6 saturday) - jsdate: Returns the short JS date format

public OC\L10N\L10N::getTranslations()
Returns an associative array with all translations
Called by \OC_L10N_String
Source:lib/private/L10N/L10N.php#209
Returns:array
public OC\L10N\L10N::getIdentityTranslator()
Source:lib/private/L10N/L10N.php#217
Returns:\Symfony\Component\Translation\IdentityTranslator
protected OC\L10N\L10N::load($translationFile)
Source:

lib/private/L10N/L10N.php#230

Parameters:
  • $translationFile (string)
Returns:

bool