0
votes

Using Cake version 3.4.5 :

1) I've wrote a plugin :

/plugins/Accounting/

2) then, to create the pot file from the view files I run :

bin/cake i18n extract --plugin Accounting

3) this generates /plugins/Accounting/src/Locale/default.pot

But the translated text does not appear. My locale is es_AR, and I've tried to copy the file as :

/plugins/Accounting/src/Locale/accounting.pot

or

/plugins/Accounting/src/Locale/es_AR/default.pot 

or

/plugins/Accounting/src/Locale/es_AR/accounting.pot 

Also tried to save the files as accounting.po, but nothing happens

But still not text is translated from the plugin views (it does work for the app's views).

1
Shouldnt you translate them into .po files then?mark
Sorry I didn't mention that. I've also tried it with no results at all.user1077915
I usually copied over the plugin PO files to the APP/src/Locale folder - and then it worked.mark
Didn't work for me. By now the only way is to include the plugin's po file inside the default.po file of the main app. I'll keep trying. Thanks. Regards.user1077915

1 Answers

4
votes

I've found it !!!

The problem was the file / directory permissions.

By default, cake i18n extract --plugin MyPlugin makes this :

  1. creates the src/Locale/ directory inside the plugin structure
  2. creates the template translation file default.pot instead of my_plugin.pot
  3. all these creations are made with mode 750 being the owner the linux user currently logged in ( not www-data )

So in order to make it work :

  1. change the permissions of the Locale structure to 755
  2. rename default.pot to my_plugin.po
  3. use __d( 'my_plugin', 'Text to be translated' )