https://github.com/webforge-labs/webforge-translation
Wrapper around the symfony translator for standalone use
https://github.com/webforge-labs/webforge-translation
Last synced: over 1 year ago
JSON representation
Wrapper around the symfony translator for standalone use
- Host: GitHub
- URL: https://github.com/webforge-labs/webforge-translation
- Owner: webforge-labs
- Created: 2013-06-04T06:02:15.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2014-06-29T09:47:21.000Z (about 12 years ago)
- Last Synced: 2025-02-06T13:19:30.575Z (over 1 year ago)
- Language: PHP
- Size: 215 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# webforge-translation
[](https://coveralls.io/r/webforge-labs/webforge-translation?branch=master)
Wrapper around the symfony translator for standalone use
## installation
Use [Composer](http://getcomposer.org) to install.
```
composer require -v --prefer-source webforge/translation:dev-master
```
to run the tests use:
```
phpunit
```
## usage
```php
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