https://github.com/pleinx/php-multilang-any
Handles easy your translations for your multi language PHP Project.
https://github.com/pleinx/php-multilang-any
i18n multilanguage translations translations-api translator
Last synced: 6 months ago
JSON representation
Handles easy your translations for your multi language PHP Project.
- Host: GitHub
- URL: https://github.com/pleinx/php-multilang-any
- Owner: pleinx
- License: mit
- Created: 2017-05-18T16:16:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-30T23:43:05.000Z (almost 4 years ago)
- Last Synced: 2025-03-28T22:35:12.925Z (6 months ago)
- Topics: i18n, multilanguage, translations, translations-api, translator
- Language: PHP
- Homepage:
- Size: 36.1 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://packagist.org/packages/pleinx/php-multilang-any)
[](https://packagist.org/packages/pleinx/php-multilang-any)

[](https://packagist.org/packages/pleinx/php-multilang-any)##### fyi: Currently not complete documented :-) Working on it...
#### Description
Handles easy your translations for your multi language PHP Project.
#### Basic Features
* [Production/Debug Modus](https://github.com/pleinx/php-multilang-any/wiki)
* [JSON-Files](https://github.com/pleinx/php-multilang-any/wiki) as Language-Resource
* Efficient loading of [Language-Packages](https://github.com/pleinx/php-multilang-any/wiki)
* [Automatic detection](https://github.com/pleinx/php-multilang-any/wiki) of Language (optional)#### Translator Features
* Write your [own Translate](https://github.com/pleinx/php-multilang-any/wiki) Function like `__('foo', ['bar'])`
* Supports HTML-Markup in Translation## Installation via Composer
```ini
composer require pleinx/php-multilang-any
```##### Don't have Composer?
Just download it here: [https://getcomposer.org/](https://getcomposer.org/)## Basic Usage
```ini
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](https://github.com/pleinx/php-multilang-any/wiki).
## Customize
```ini
$settings = (new TranslatorSettings())
->setIsProduction(false)
->setLanguage('de')
->setFallbackLanguage('en')
->setLanguageFilesPath(__DIR__ . '/lang');new TranslatorAPI($settings);
```**Notice:** Or just change the Default Settings, see [here](https://github.com/pleinx/php-multilang-any/wiki).
#### Language Resource Example (JSON)
```ini
// 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)