Download the PHP package phalcon/incubator-translate without Composer

On this page you can find all versions of the php package phalcon/incubator-translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?

All versions of incubator-translate with dependencies

Informations about the package incubator-translate

Phalcon\Incubator\Translate

Discord Packagist Version PHP from Packagist codecov Packagist

Issues tracker

https://github.com/phalcon/incubator/issues

Database

You can use your database to store the translations, too.

First of all, you need to up your database. To do this, use [DI][1] (in /public/index.php). Take a look:

Then, you should get the translation through your controller. Put this on it:

To store the translations, the following table is recommended:

Optional create unique index

The columns are self-described, but pay attention to language — it's a column that stores the language that the user is using, that can be en, en-us or en-US. Now it's your responsibility to decide which pattern you want to use.

To display for your users the translated words you need to set up a variable to store the expressions/translations from your database. This step happens in your controller. Follow the example:

Then, just output thephrase/sentence/word in your view:

Or, if you wish you can use [Volt][2]:

Mongo

Implements a Mongo adapter for translations.

A generic collection with a source to store the translations must be created and passed as a parameter.

MultiCsv

This adapter extends Phalcon\Translate\Adapter\Csv by allowing one csv file for several languages.

use Phalcon\Translate\Adapter\NativeArray; use Phalcon\Translate\Interpolator\Intl;

$translate = new NativeArray( [ 'interpolator' => new Intl('en_US'), // this interpolator must be locale aware 'content' => [ 'hi-name' => 'Hello {name}, it\'s {time, number, integer} o\'clock', ], ] );

$name = 'Henry';

// Hello Henry, it's 8 o'clock $translate->_( 'hi-name', [ 'name' => $name, 'time' => 8, ] );


Version
Requires php Version >=7.2
ext-phalcon Version ^4.0

The package phalcon/incubator-translate contains the following files

Loading the files please wait ....