CakePHP has one of the coolest features to make application Internationalization & Localization. It’s really easy to translate your application or website into multiple languages with CakePHP 3. Let’s see it.
First of all, create a directory Locale inside PROJECT_ROOT/src
Create a subdirectory of each language (which language you want to translate your application) inside PROJECT_ROOT/src/Locale/. Subdirectory name can be anything (ex. english, french, etc), but prefer ISO code of the language (ex. en_US, fr_FR, bn_BN etc). So follow this tutorial and make your subdirectory name en_US, fr_FR, and bn_BN
Create default.po file inside all subdirectories (en_US, fr_FR, and bn_BN). And copy the following code in the respective file.
msgstr "Hello World"
msgstr "Bonjour le monde"
msgstr "ওহে বিশ্ব"
Here msgid key of which will use inside the template (view files) and msgstr is the values which will gonna translate.
So now you have three different languages (en_US, fr_FR, and bn_BN). and one key (message) which can be translated into these three languages.
Now use <?php echo __(‘message’); ?> in your view (any ctp file of your application).
Then open PROJECT_ROOT/config/app.php file and find
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'fr_FR')
and replace with your language.
But if you want to translate language in runtime then you can use it
I hope this article will help you to translate your application in multiple language.