azettl/php-nano-translation

The php-nano-translation class gives you the correct translation from the requested JSON file.

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/azettl/php-nano-translation

0.0.1 2017-08-02 14:49 UTC

This package is auto-updated.

Last update: 2025-10-06 00:30:13 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"