PHPackages                             stanislav-web/phalcon-translate - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. stanislav-web/phalcon-translate

ActiveLibrary[Localization &amp; i18n](/categories/localization)

stanislav-web/phalcon-translate
===============================

Phalcon Translate Service. Simple way to translate your costom part of templates :-)

1.3.1-stable(10y ago)122933[1 issues](https://github.com/stanislav-web/phalcon-translate/issues)MITHTMLPHP &gt;=5.4.0

Since Jan 28Pushed 10y ago2 watchersCompare

[ Source](https://github.com/stanislav-web/phalcon-translate)[ Packagist](https://packagist.org/packages/stanislav-web/phalcon-translate)[ Docs](https://github.com/stanislav-web/phalcon-translate)[ RSS](/packages/stanislav-web-phalcon-translate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (8)Used By (0)

Phalcon Translate Service
=========================

[](#phalcon-translate-service)

[![Code Coverage](https://camo.githubusercontent.com/2d621df7ec1733a6c7ed90ab2be8b607377d6052f6f4d48e85d8b640d938c94b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7374616e69736c61762d7765622f7068616c636f6e2d7472616e736c6174652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/stanislav-web/phalcon-translate/?branch=master) [![Total Downloads](https://camo.githubusercontent.com/aef5970e7f8d59c6becedfe5709cf71ebe3f827a3736a1ae8c37afd0ccddd9ee/68747470733a2f2f706f7365722e707567782e6f72672f7374616e69736c61762d7765622f7068616c636f6e2d7472616e736c6174652f646f776e6c6f6164732e737667)](https://packagist.org/packages/stanislav-web/phalcon-translate) [![License](https://camo.githubusercontent.com/ebb9e5fc0be0ba04ac0b80cf265bc295b63f58a11d1f02b7450c8772ba3841c9/68747470733a2f2f706f7365722e707567782e6f72672f7374616e69736c61762d7765622f7068616c636f6e2d7472616e736c6174652f6c6963656e73652e737667)](https://packagist.org/packages/stanislav-web/phalcon-translate) [![Latest Stable Version](https://camo.githubusercontent.com/33f4bf08d4f147a4a4713cd595d868ad1b8adbc169c4baebb5d07a345c3d4f8a/68747470733a2f2f706f7365722e707567782e6f72672f7374616e69736c61762d7765622f7068616c636f6e2d7472616e736c6174652f762f737461626c652e737667)](https://packagist.org/packages/stanislav-web/phalcon-translate)

Phalcon Translate Service. Simple way to translate your costom part of templates :-)

Changelog
---------

[](#changelog)

- 1.3.1 \[FIX\] Default language use
- 1.3 \[FIX\] Support for Phalcon 2.x // \[Minor fix\] Translate Adapter Native offsetGet is not work on 2.0
- 1.2 \[FIX, FEATURE\] The ability to reuse a set of translations in various services
- 1.1 Added setDefault() method to watch undefined languages

Compatible
----------

[](#compatible)

- PSR-1, PSR-2, PSR-4 Standards

System requirements
-------------------

[](#system-requirements)

- PHP 5.4.x &gt;
- Phalcon extension 1.3.x, 2.x

Install
-------

[](#install)

First update your dependencies through composer. Add to your composer.json:

```
"require": {
    "stanislav-web/phalcon-translate": "1.*"
}
```

```
php composer.phar install
```

OR

```
php composer.phar require stanislav-web/phalcon-translate 1.*
```

*(Do not forget to include the composer autoloader)*

Or manual require in your loader service

```
    $loader->registerNamespaces([
        'Translate\Translator' => 'path to src'
    ]);
```

You can create an injectable service

```
    $this->di['translate'] = function() {
        return new Translate\Translator();
    };
```

Usage
-----

[](#usage)

#### recomended configuration for translate directory (as example)

[](#recomended-configuration-for-translate-directory-as-example)

```
/app/languages/{LANG}/{PART}.php

LANG meant "ru", "en", "de"
PART meant "menu", "header", "footer"

```

#### files for translation

[](#files-for-translation)

```
