2017 © Pedro PelĂĄez
 

library translator

Translator component

image

gobline/translator

Translator component

  • Wednesday, February 1, 2017
  • by mdecaffmeyer
  • Repository
  • 2 Watchers
  • 2 Stars
  • 79 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

Translator component

The Translator component aids in building multilingual applications., (*1)

Creating the Translator

$translator = new Gobline\Translator\Translator();

Adding a Translation File

$translator->addTranslationFile(__DIR__.'./translations/fr/messages.php', 'fr');

At the moment, only PHP arrays are supported., (*2)

Adding a Directory of Translation Files

$translator->addTranslationFile(__DIR__.'./translations/nl', 'nl');

The directory will be searched recursively for translations files., (*3)

Adding an Array of Translations

$translator->addTranslationArray(['First name' => 'Vorname'], 'de');

Translate a Message

$translator->setDefaultLanguage('fr'); // you can set a default language

$translator->translate('First name'); // no language specified, using def. lang "fr" and returns "Prénom"

$translator->translate('First name', null, 'nl'); // returns "Voornaam"

$translator->translate('First name', null, 'it'); // no Italian translations provided, returns "First name"

$translator->translate('User %1 created', 'John'); // returns "Utilisateur John créé"

$translator->translate('User %1 %2 created', ['John', 'Smith']); // returns "Utilisateur John Smith créé"

Installation

You can install the Translator component using the dependency management tool Composer. Run the require command to resolve and download the dependencies:, (*4)

composer require gobline/translate

The Versions

01/02 2017

dev-master

9999999-dev https://github.com/gobline

Translator component

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

by Mathieu Decaffmeyer

translator i18n internationalization translate gobline

20/12 2015

v2.0.1

2.0.1.0 https://github.com/gobline

Translator component

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

by Mathieu Decaffmeyer

translator i18n internationalization translate gobline

03/12 2015

v2.0.0

2.0.0.0 https://github.com/gobline

Translator component

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

by Mathieu Decaffmeyer

translator i18n internationalization translate gobline

17/01 2015

v1.0.1

1.0.1.0 https://github.com/mendoframework

Mendo Translator Component

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

by Mathieu Decaffmeyer

translator i18n internationalization translate mf mendoframework mendo framework

15/11 2014

v1.0.0

1.0.0.0 https://github.com/mendoframework

Mendo Translator Component

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

by Mathieu Decaffmeyer

translator i18n internationalization translate mf mendoframework mendo framework