Handles easy your translations for your multi language PHP Project.
- Production/Debug Modus
- JSON-Files as Language-Resource
- Efficient loading of Language-Packages
- Automatic detection of Language (optional)
- Write your own Translate Function like
__('foo', ['bar']) - Supports HTML-Markup in Translation
composer require pleinx/php-multilang-anyJust download it here: https://getcomposer.org/
Translate::__e('Foo', ['Bar']);
// Output "Foo is nicer than Bar"By default the TranslatorAPI load the Translations in ./languageFiles/.
Notice: You find all these default parameters here.
$settings = (new TranslatorSettings())
->setIsProduction(false)
->setLanguage('de')
->setFallbackLanguage('en')
->setLanguageFilesPath(__DIR__ . '/lang');
new TranslatorAPI($settings);Notice: Or just change the Default Settings, see here.
// package_serach.json
{
"results.success.text": "Your search Results for {{searchTerm}}.",
"results.failed.text": "Nothing found for {{searchTerm}}",
"results.success.itemsInCategories": "Found {{itemsCount}} in {{categories}}"
}- PHP 7.4 and above (tested with php8)