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

This package is auto-updated.

Last update: 2024-04-05 21:17:44 UTC


README

Codacy Badge Codacy Badge

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"