pleinx/php-multilang-any
Composer 安装命令:
composer require pleinx/php-multilang-any
包简介
A simple resolver for language snippets.
关键字:
README 文档
README
fyi: Currently not complete documented :-) Working on it...
Description
Handles easy your translations for your multi language PHP Project.
Basic Features
- Production/Debug Modus
- JSON-Files as Language-Resource
- Efficient loading of Language-Packages
- Automatic detection of Language (optional)
Translator Features
- Write your own Translate Function like
__('foo', ['bar']) - Supports HTML-Markup in Translation
Installation via Composer
composer require pleinx/php-multilang-any
Don't have Composer?
Just download it here: https://getcomposer.org/
Basic Usage
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.
Customize
$settings = (new TranslatorSettings()) ->setIsProduction(false) ->setLanguage('de') ->setFallbackLanguage('en') ->setLanguageFilesPath(__DIR__ . '/lang'); new TranslatorAPI($settings);
Notice: Or just change the Default Settings, see here.
Language Resource Example (JSON)
// 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}}"
}
Requirements
- PHP 7.4 and above (tested with php8)
统计信息
- 总下载量: 55
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-18