PHPackages                             lumen/translator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lumen/translator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lumen/translator
================

Universal translator of \[string, array, object\].

2235PHP

Since Apr 24Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jcarrizalez/translator)[ Packagist](https://packagist.org/packages/lumen/translator)[ RSS](/packages/lumen-translator/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Translator - for Lumen
======================

[](#translator---for-lumen)

\[![Total Downloads]()\[![Latest Stable Version 2.0]()

Translator is a package to generate data and to translate data:

Build:
------

[](#build)

Read the Lumen Application Seeders files and write the json files with a friendly structure for editing "see configuration"

Translator:
-----------

[](#translator)

Has several methods to translate array, obejct and string can receive a matrix of objects with array and the answer will be the translation of it without altering its structure

Installation
------------

[](#installation)

Install the latest version with

```
$ composer require lumen/translator
```

or edit your `composer.json`

```
{
	"require": {
        "lumen/translator": "^2.0@dev"
    }
}
```

```
$ composer update
```

Configuration
-------------

[](#configuration)

```
$ php vendor/lumen/translator/configuration.php --config
```

The previous command will create the following directory and files:

```
your_app_name/
├── translator/
│ ├── configuration.json
│ ├── default.json
│ ├── en-AR.json
│ ├── en-US.json
│ └── pt-BR.json
```

configuration.json:

```
{
    "default": "",
    "column_table": [],
    "not_tables": [],
    "file_config": [],
    "filter_column": []
}
```

`Desciption configuration.json:` Configuration file with

```
`default`: default language example file name "es-AR"
`column_table`: columns of the tables to read (only columns string, text, varchar*)
`not_tables`: tables that will not be translated
`file_config`: configuration translation files that are in your_app_name/config/
`filter_column`: columns with data that does not want translation

```

default.json:

```
{
    "table_a.000": "Hola Mundo",
    "table_b.001": "Mi nombre es",
    "table_b.002": "el mundo es todo"
}
```

`Description default.json:` dynamic data created by the execution of seeders

es-AR.json:

```
{
    "table_a.000": "Hola Mundo",
    "table_b.001": "Mi nombre es",
    "table_b.002": "el mundo es todo"
}
```

`Description es-AR.json:` for user data and you must add the keys that are in default.json with the translation that applies

en-US.json:

```
{
    "table_a.000": "Hello World",
    "table_b.001": "My name is",
    "table_b.002": "the world is all"
}
```

`Description en-US.json:` manual data and you must add the keys that are in default.json with the translation that applies

pt-BR.json:

```
{
    "table_a.000": "Olá mundo",
    "table_b.001": "Meu nome é",
    "table_b.002": "o mundo é tudo"
}
```

`Description pt-BR.json:` manual data and you must add the keys that are in default.json with the translation that applies

Edit your `.gitignore` and add

```
/laravel/translator/default.json

```

Create Traits for more control and use in `/app/Traits/Translator.php`

```
