Localizing timeAgoInWords in CakePHP

In my CakePHP application, using cake.bat, I created POT files and using PoEdit I created PO files. Thus, by writing __ ('myword') , I can see the localized word in my application successfully.

But now I need to localize "timeAgoInWords". When I run cake i18n extract , the script did not receive the word _dn () in CakeTime http://api20.cakephp.org/view_source/cake-time#line-522

So, I created the dummy.ctp file and copied the contents from the cake-time file to a dummy file. I run the cake script and POEdit again. And he created instances like below in the file app / Locale / tur / LC_MESSAGES / default.po

#: View\App\dummy.ctp:30;33
msgid "%d minute"
msgid_plural "%d minutes"
msgstr[0] "%d dakika"
msgstr[1] "%d dakika"

In core.php, I already set the default language to Turkish:

Configure::write('Config.language', 'tur');

But when I test my application, the results of timeAgoInWords come in English.

How can i fix this

+5
source share
1 answer

Cake messages are retrieved to another domain, in this case, to the domain cake. This means that the cake messages will not be extracted to your file default.pot, but will be included in the file cake.pot.

, cake.pot, , , i18n , ​​ . ( #):

$:/var/www/path/app$ cake i18n extract

# if will ask you here if you want to extract from your app folder
# simply press enter to confirm
What is the path you would like to extract?
[Q]uit [D]one  
[/var/www/path/app/]

# now it will ask you again, in this case enter the cake path
What is the path you would like to extract?
[Q]uit [D]one  
[D] > /var/www/path/lib/Cake

# third time, just press enter
What is the path you would like to extract?
[Q]uit [D]one  
[D] > 

# press enter to accept the app/Locale
What is the path you would like to output?
[Q]uit  
[/var/www/path/app//Locale] > 

# press enter to keep translation domains deparate
Would you like to merge all domains strings into the default.pot file? (y/n) 
[n] > 

;)

+7

All Articles