Jump to content

Příručka:$wgMessagesDirs

From mediawiki.org
This page is a translated version of the page Manual:$wgMessagesDirs and the translation is 80% complete.
Outdated translations are marked like this.
Rozšíření: $wgMessagesDirs
Adresáře zpráv rozšíření.
Zavedeno od verze:1.24.0 (Gerrit change 102957; git #2f7b68ff)
Odstraněno od verze:stále se používá
Povolené hodnoty:(pole)
Výchozí hodnota:[]

A configurable global variable pointing to the path of a directory that contains message files. It works with associative arrays as demonstrated below. Očekává se, že soubory zpráv budou soubory JSON pojmenované podle jejich kódu jazyka, např. en.json, de.json atd. Rozšíření se zprávami na více místech mohou specifikovat pole adresářů zpráv.

The modern approach that is recommended for extensions is not to use $wgMessagesDirs directly but to use the equivalent key in extension.json.

Examples

Jednoduchý příklad:

PHP extension.json
$wgMessagesDirs['ConfirmEdit'] = __DIR__ . '/i18n';
"MessagesDirs": {
 "ConfirmEdit": [
  "i18n"
 ]
}

Komplexní příklad:

PHP extension.json
$wgMessagesDirs['VisualEditor'] = [
    __DIR__ . '/i18n',
    __DIR__ . '/modules/ve-core/i18n',
    __DIR__ . '/modules/qunit/localisation',
    __DIR__ . '/modules/oojs-ui/messages',
];
"MessagesDirs": {
 "VisualEditor": [
  "i18n",
  "modules/ve-core/i18n",
  "modules/qunit/localisation",
  "modules/oojs-ui/messages"
 ]
}

$wgMessagesDirs může koexistovat s $wgExtensionMessagesFiles . Obojí by mělo být nastaveno, pokud chcete zachovat kompatibilitu při převádění starých souborů PHP l10n.

Související odkazy