Nextcloud PHP API (master)

IL10N

Interface IL10N

Tags
since
6.0.0

Table of Contents

Methods

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<string|int, mixed> $options = [] ]) : string|int|false
Parameters
$type : string

Type of localization

$data : DateTime|int|string

parameters for this localization

$options : array<string|int, mixed> = []

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<string|int, mixed> $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<string|int, mixed> = []

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|int, mixed>|string $parameters = [] ]) : string
Parameters
$text : string

The text we need a translation for

$parameters : array<string|int, mixed>|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.


        
On this page

Search results