paliari / php-i18n
Installs: 3 006
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- symfony/yaml: ^4.2
Requires (Dev)
- phpunit/phpunit: ^8.1
README
Installation
$ composer require paliari/php-i18n
Configuration
Create your yml locale files inside some folder in your project. See the yml file example:
pt-BR: hello: Olá I18n user: name: Nome do usuário errors: messages: unauthorized: Não autorizado
You can use multiple languages and multiple files for each language, ex:
- pt-BR.yml
- models.pt-BR.yml
- errors.pt-BR.yml
- en.yml
- models.en.yml
- errors.en.yml
Say to the plugin where this files were placed
\Paliari\I18n::instance()->addLocalesPath(__DIR__ . '/config/locales')->setCurrentLocale('pt-BR');
Usage
Paliari\I18n::instance()->hum('hello');