Download the PHP package terminal42/dc_multilingual without Composer

On this page you can find all versions of the php package terminal42/dc_multilingual. 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 dc_multilingual

DC_Multilingual

This is a standalone DC driver for Contao Open Source CMS that allows you to easily make your data translatable.

DCA configuration

Example usage

Querying using the model

How does it work under the hood

Basically, the driver just stores translations into the same table, building up a relationship to its parent entry using the "langPid" (or whatever you configured it to be) column. In the back end list and tree view it makes sure translations are filtered so you only see the fallback language there. When querying using the Multilingual model or using the MultilingualQueryBuilder, the same table is simply joined so we have the fallback language aliased as t1 and the target language (which you specify explicitly or it uses the current page's language) aliased as translation. Now, using MySQL's IFNULL() function, it checks whether there's a translated value and if not, automatically falls back to the fallback language. This allows you to translate only a subset of fields.

Alias handling

You can share the alias for all translations, so you'd have something like this:

* EN: domain.com/my-post/my-beautiful-alias.html
* DE: domain.de/mein-artikel/my-beautiful-alias.html
* FR: domain.fr/mon-post/my-beautiful-alias.html

This can be achieved by using the regular alias handling you may know from other modules such as news etc. in the back end and for the front end you simply use the findByAlias() method which the Multilingual model provides:

However, there are many situations where you would like to have your aliases translated so you end up with something like this:

* EN: domain.com/my-post/my-beautiful-alias.html
* DE: domain.de/mein-artikel/mein-wunderschoenes-alias.html
* FR: domain.fr/mon-post/mon-alias-magnifique.html

In the back end it's slightly more difficult now because it does not make sense to check for duplicate aliases within the whole table but only within the whole table and the same language. To make this as easy as possible for you, simply use the following eval definitions on your alias field:

It will automatically generate an alias if not present yet and check for duplicates within the same language.

In the front end you can then search by a multilingual alias like this:

Usage with Doctrine entities

Since the driver only writes data to the database from the backend, it is fully compatible with using Doctrine entities in the frontend. For now, you must take care of translations yourself though. Here's how an entity could look like:

Useful notes

  1. Sometimes a table you want to make multilingual already contains the language field (e.g. tl_user), which may lead to unexpected results. In such cases you have to make sure that data container's property $GLOBALS['TL_DCA']['tl_table']['config']['langColumnName'] is set to something else than language. See #53 for more details.

All versions of dc_multilingual with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
contao/core-bundle Version ^4.13.51
doctrine/dbal Version ^2.11 || ^3.0
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 terminal42/dc_multilingual contains the following files

Loading the files please wait ....