PHPackages                             alexya-framework/localization - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. alexya-framework/localization

ActiveFramework[Framework](/categories/framework)

alexya-framework/localization
=============================

Alexya's Localization utilities

3.1.0(9y ago)036GNUPHPPHP &gt;=7.0

Since Aug 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/AlexyaFramework/Localization)[ Packagist](https://packagist.org/packages/alexya-framework/localization)[ RSS](/packages/alexya-framework-localization/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (7)Used By (0)

Localization
============

[](#localization)

Alexya's localization components

Contents
--------

[](#contents)

- [Text translation](#text_translation)
    - [Instantiating Translator objects](#instantiating_translator_objects)
    - [Translating texts](#translating_texts)

Text translation
----------------

[](#text-translation)

The class `\Alexya\Localization\Translator` offers a way for translating texts. Bassically you instance a `Translator` object with the given text translatation and the you call the `translate` method whenever you want to translate a text.

### Instantiating Translator objects

[](#instantiating-translator-objects)

The constructor accepts as parameter an associative array containing the language code and the translations. Optionally you can send a second parameter being the default language where the texts will be translated.

Example:

```
