Nextcloud PHP API (stable19)

IL10N

Interface IL10N

Tags
since
6.0.0

Table of Contents

getLanguageCode()  : string
The code (en, de, ...) of the language that is used for this IL10N object
getLocaleCode()  : string
* The code (en_US, fr_CA, ...) of the locale that is used for this IL10N object
l()  : string|int|false
Localization
n()  : string
Translating
t()  : string
Translating

Methods

getLanguageCode()

The code (en, de, ...) of the language that is used for this IL10N object

public getLanguageCode() : string
Tags
since
7.0.0
Return values
string

language

getLocaleCode()

* The code (en_US, fr_CA, ...) of the locale that is used for this IL10N object

public getLocaleCode() : string
Tags
since
14.0.0
Return values
string

locale

l()

Localization

public l(string $type, DateTime|int|string $data[, array $options = [] ]) : string|int|false
Parameters
$type : string

Type of localization

$data : DateTime|int|string

parameters for this localization

$options : array = []

currently supports following options:

  • 'width': handed into \Punic\Calendar::formatDate as second parameter
Tags
since
6.0.0
  • parameter $options was added in 8.0.0
Return values
string|int|false

Returns the localized data.

Implemented types:

  • date
    • Creates a date
    • l10n-field: date
    • params: timestamp (int/string)
  • datetime
    • Creates date and time
    • l10n-field: datetime
    • params: timestamp (int/string)
  • time
    • Creates a time
    • l10n-field: time
    • params: timestamp (int/string)

n()

Translating

public n(string $text_singular, string $text_plural, int $count[, array $parameters = [] ]) : string
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

Tags
since
6.0.0
Return values
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.

t()

Translating

public t(string $text[, array|string $parameters = [] ]) : string
Parameters
$text : string

The text we need a translation for

$parameters : array|string = []

default:array() Parameters for sprintf

Tags
since
6.0.0
Return values
string

Translation or the same text

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

Search results