Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foo123/localizer
Simple class to localize texts for PHP, JavaScript, Python
https://github.com/foo123/localizer
i18n l10n localization
Last synced: about 1 month ago
JSON representation
Simple class to localize texts for PHP, JavaScript, Python
- Host: GitHub
- URL: https://github.com/foo123/localizer
- Owner: foo123
- Created: 2022-08-23T18:40:52.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-28T14:00:20.000Z (about 2 years ago)
- Last Synced: 2023-03-16T03:55:37.590Z (over 1 year ago)
- Topics: i18n, l10n, localization
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Localizer
Simple class to localize texts for PHP, JavaScript, Python
**Example**
```php
$l10n = new Localizer();// setup supported locales
$l10n->locale('en', []);
$l10n->locale('el', [
'I want to say {0}' => 'Θέλω να πώ {0}',
'hello to you' => 'γειά σε σένα',
'hello to all' => 'γειά σε όλους'
]);// set current locale
$l10n->locale('el', true);echo 'Localizer::VERSION = ' . Localizer::VERSION . PHP_EOL;
echo $l10n->locale() . PHP_EOL;echo $l10n->cl('hello to you', 'γειά σε σένα') . PHP_EOL;
echo $l10n->cl('hello to all', 'γειά σε όλους') . PHP_EOL;echo $l10n->l('hello to you') . PHP_EOL;
echo $l10n->l('hello to all') . PHP_EOL;echo $l10n->l('I want to say {0}', [$l10n->l('hello to you')]) . PHP_EOL;
echo $l10n->l('I want to say {0}', [$l10n->l('hello to all')]) . PHP_EOL;echo $l10n->ln(1, 'hello to you', 'hello to all') . PHP_EOL;
echo $l10n->ln(2, 'hello to you', 'hello to all') . PHP_EOL;
```