Statistics
8
1
0
72d
Badges
Dependencies

Localization

Simple Translator for Nette Framework

Requirements

Installation

Install with Composer:

$ composer require zahy/localization

Register extension:

extensions:
	localization: ZahyCZ\Localization\DI\Extension

Configuration:

localization:
  languages: ['cs', 'en']
  locPath: '/../localization'
  storageName: 'ZahyCZ.Localization'

Localization files example:

Example:
	cs: Příklad
	en: Example

Example file name: example.loc.neon

Using

Inject Service:

/**
* Translator
* @var Nette\Localization\ITranslator @inject
*/
public $translator;

Using in PHP:

$this->translator->setLanguage('cs');
$this->translator->translate('Example', ['text']);

Using in Latte:

{_'Example', ['text']}
  • v0.1.1 Changed loc files extension and little refactoring

    • changend loc file extenions from loc.example.neon to example.loc.neon
    • change untranslated neon write
    • code refactoring
  • v0.1.0 Version 0.1.0

  • v0.0.1 Version 0.0.1

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com