webforge / translation
Translation component based on symfony/translation
Installs: 1 071
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- symfony/config: 2.3.*@stable
- symfony/finder: 2.3.*@stable
- symfony/translation: 2.3.*@stable
Requires (Dev)
- liip/rmt: 0.9.*
- satooshi/php-coveralls: dev-master
- webforge/testplate: 1.2.*@dev
README
Wrapper around the symfony translator for standalone use
installation
Use Composer to install.
composer require -v --prefer-source webforge/translation:dev-master
to run the tests use:
phpunit
usage
<?php use Webforge\Translation\ArrayTranslator; $translations = Array( 'de'=>Array( 'hello'=>'Hallo Welt!' ), 'en'=>Array( 'hello'=>'Hello World!', 'how'=>'How are you?' ), ); $translator = new ArrayTranslator('de', $translations, $fallback = array('en')); print $translator->trans('hello')."\n"; // Hallo Welt! print $translator->trans('how')."\n"; // How are you? $translator->setLocale('en'); print $translator->trans('hello')."\n"; // Hello World!
dependencies
- symfony/translation 2.3