The aim of this article is to document how a multilingual webapp can be built.
We use a plugin called "wnk_translation" which support collaborative translations. For installation change to your application directory where the file composer.json is located and fire this command:
cd /usr/local/www/........ composer require ava007/wnk_translationUsing version ^0.1.0 for ava007/wnk_translation ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) - Updating ava007/wnk_translation (dev-master b741157 => v0.1) Checking out b7411573961cb98c6f407a7e8004459d9ef2f86f Writing lock file Generating autoload files > Cake\Composer\Installer\PluginInstaller::postAutoloadDump #
We also need to change the configuration in bootstrap.php. Our based language will be English and translations are made in German.
Plugin::load('WnkTranslation', ['routes' => true, 'autoload' => true, 'bootstrap' => false]); Configure::write('WnkTranslation', [ 'default_lang' => 'en', 'trans_lang' => ['de'], ]);
Now we need to population our po File by issuing this command.
/usr/local/bin/php /usr/local/www/xapp/bin/cake.php i18n extract --app /usr/local/www/xapp/src \ --output /usr/local/www/xapp/src/Locale/ --paths /usr/local/www/xapp/src/ --merge yes --overwrite --extract-core no \ --exclude tests,vendor,plugins --exclude-plugins --verbose > /usr/local/www/xapp/logs/i18nextract.txtNext: Creating a Plugin with Bake for CakePHP 3 UP: TOC