User Tools

Site Tools


programmieren:cakephp:translations

Translations

In CakePHP translations work with the integrated cakephp/i18n plugin. i18n stands for internationalization because there are 18 letters between the initial i and the ending n.

You define a to-be-translated text like so:

__dx(
    'Admin',
    'Tenant-form',
    'The deadline in days after which a tenant can no longer cancel a policy. Negative values are before the validity start of a policy, positive ones are after.'
),

Admin being the domain, so basically the file this will get saved in.

Tenant-form being the context, for easier access and navigation

And the long text being the actual text that needs to be translated.

If you define something like this and run ant extract-i18n (yes we have a build script for this) it will automatically find and extract the texts to a .pot file. However to translate it into different languages you'll need to update each languages .po according to the .pot file which contains the extracted texts.

The programm used for the translations is Poedit which is basically made for exactly that, editing translations.

A translation can for example look like this:

When saving it, a binary file is also created for the application to work properly with the translation.

We use this in most of our applications, all that have a UI basically.

programmieren/cakephp/translations.txt · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki