azettl / php-nano-translation
The php-nano-translation class gives you the correct translation from the requested JSON file.
0.0.1
2017-08-02 14:49 UTC
Requires
- php: ^7.1
- azettl/php-nano-template: 0.0.3
This package is auto-updated.
Last update: 2025-03-05 23:21:01 UTC
README
The php-nano-translation class gives you the correct translation from the requested JSON file.
Installation
composer require azettl/php-nano-translation
Usage
require __DIR__ . '/vendor/autoload.php'; $oTranslation = new com\azettl\nano\translation(); $oTranslation->setBasePath('vendor/azettl/php-nano-translation/tests/translations/'); $oTranslation->setFileNamePattern('test.%s.json'); echo $oTranslation->translate('MY_KEY_WITH_VARS', 'en', ['variable' => 'test']);
Translation Key Value: "My {variable} Value" Returns: "My test Value"