-
Notifications
You must be signed in to change notification settings - Fork 1
Translations
xolf edited this page Jul 13, 2018
·
4 revisions
All the translation files are located in /files/Translations/{language}
.
The normal fallback language is de
, however you're able to change this in your _conf.php
.
So if no specific language is provided, Dreamcoil will use the translation from the fallback directory.
All translation files return an array, with the translations. The file name is used for the namespace.
$trans = new Translate();
// Hello
echo $trans->get('main.hello');
// Static example:
// Hello
echo \Dreamcoil::__('main.hello');
// Placeholder example:
// Dreamcoil reached 2134 downloads
echo $trans->get('main.downloads', ['downloads' => 2134]);
// Disable HTML-Escaping
echo $trans->get('main.escape'); // Ö - ä
define("DISABLE_DREAMCOIL_TRANSLATE_HTML_ESCAPE", true);
echo $trans->get('main.escape'); // Ö - ä
return [
'hello' => 'Welcome to Dreamcoil!',
'downloads' => 'Dreamcoil reached %downloads% downloads',
'escape' => 'Ö - ä'
]
All translate keys, got stored. So Dreamcoil looks for a file once, saves all the translation keys to memory.