paliari/php-i18n

1.2.0 2019-05-21 16:38 UTC

This package is auto-updated.

Last update: 2024-04-22 04:33:03 UTC


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');

Authors