Download the PHP package davidpersson/li3_translate without Composer

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

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package li3_translate

Translatable Behavior

What this behavior does is enable you to have content of different locales/languages to be stored in your database via your lithium based model. You can also search and retrieve locale specific data simply.

At this moment the plugin is compatible with MongoDB and all relational databases supported by lithium.

Installation

Install the plugin via composer (this will also pull in any dependencies):

Usage

In the model you wish to have translatable please add something to the tune of:

Good example usage of the plugin can be seen in the unit tests, but here is a brief description.

Saving Data

When saving data with the default locale, you basically don't have to change anything. When saving translated data along with the original data use one of the following syntax (all are equivalent):

When saving just translated data i.e. when updating an already existing record use the following syntax. Please note that in this case original data (for the default locale must already be present).

Retrieving translated Entities

If you don't want to use the translate() method to translate single fields, but want the record translated into a single locale use the following syntax. You can then retrieve field data as normal.

This is good for display purposes. For saving data use the syntax described above.

If you do not know the translation you are searching for, the translation can be searched by the following:

On-the-fly Disabling of Translations

You can disable the automatic retrieval of translations for a record:

And disable running the behavior on save:

Accessing Translations

Validation

When translations are present in the to-be-saved data, all are validated against the base rule.

Data Model

Translation data is stored inline with the entity. For MongoDB a subdocument will used, for relational databases special field names are used.

Gotchas

You should not change the locale when the model already has saved data. Otherwise manual migration will be required.

I have yet tested this plugin for white lists and other features. If you find a case that doesn't work then please log an issue.


All versions of li3_translate with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5 || ^7
unionofrad/lithium Version ^1.1
unionofrad/li3_behaviors Version ^2
composer/installers Version ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package davidpersson/li3_translate contains the following files

Loading the files please wait ....