PHPackages                             peteraba/foo-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. peteraba/foo-translate

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

peteraba/foo-translate
======================

Library for making international applications in Opulence easy.

033PHP

Since Apr 16Pushed 9y ago2 watchersCompare

[ Source](https://github.com/peteraba/FooTranslate)[ Packagist](https://packagist.org/packages/peteraba/foo-translate)[ RSS](/packages/peteraba-foo-translate/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (2)Used By (0)

FooTranslate
============

[](#footranslate)

Library for making multilingual applications in [Opulence](https://www.opulencephp.com/) easy.

[![Build Status](https://camo.githubusercontent.com/06d55f72d85bfda81357ff2ced10163856970a73ddaea26e73b730b7c12bff2c/68747470733a2f2f7472617669732d63692e6f72672f70657465726162612f466f6f5472616e736c6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/peteraba/FooTranslate)[![License](https://camo.githubusercontent.com/0b09d0f9d23d43c4ad94a110337e918f8d148c013c447f3cb92fd42eea2a3bbb/68747470733a2f2f706f7365722e707567782e6f72672f70657465726162612f666f6f2d7472616e736c6174652f6c6963656e7365)](https://packagist.org/packages/peteraba/foo-translate)[![composer.lock](https://camo.githubusercontent.com/6220bd00f913ddc64bf49db2375b42c51909b492f31ac17dcd613e2dc99ff9e4/68747470733a2f2f706f7365722e707567782e6f72672f70657465726162612f666f6f2d7472616e736c6174652f636f6d706f7365726c6f636b)](https://packagist.org/packages/peteraba/foo-translate)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/29dcfec1266344cd66044889db361a8f875147652f032191f1a72bfc6d1e6b7f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70657465726162612f466f6f5472616e736c6174652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/peteraba/FooTranslate/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/8b342ebca741fd4ce0a841f4a706dfd294164143f5c575551dd8ccea69c9a112/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70657465726162612f466f6f5472616e736c6174652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/peteraba/FooTranslate/?branch=master)[![Build Status](https://camo.githubusercontent.com/99a8e8461004d0ae0a777e1c0d33d5ca58c330219935e53e750711a7499bf8f5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70657465726162612f466f6f5472616e736c6174652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/peteraba/FooTranslate/build-status/master)

Setup
-----

[](#setup)

Install the library via composer:

```
composer install peteraba/foo-translate

```

Add the bootstrapper to you application:

```
# config/bootstrappers.php

return [
    // ...
    Foo\Translate\Bootstrapper\TranslatorBootstrapper::class,
];
```

Add your translations in `resources/lang` as it already exist for validation.

Add your default language to your `.env.app.php`:

```
Environment::setVar('DEAFULT_LANGUAGE', "hu");

```

Usage
-----

[](#usage)

Files under `resources/lang/${DEFAULT_LANG}` will be loaded automatically. Values defined in the language files are *namespaced* by a `:` character, so the value *mainPageTitle* defined in `application.php` can be referenced as *application:mainPageTitle*

User classes can access the translator via loading from the [IOC Container](https://www.opulencephp.com/docs/1.0/ioc-container) as *ITranslator*.

In [Fortune](https://www.opulencephp.com/docs/1.0/view-fortune) you can call the helper *tr* to retrieve your translations.

Example
-------

[](#example)

**resources/lang/en/form.php**

```
