I am having problems with the language used by pagination component. My site is configured to use Spanish (‘language’=>‘es’ in config/main.php) and it works, since form validation messages are correctly displayed in Spanish. However, words shown by pagination component are still written in English.
I saw that messages/es/yii.php file contains correct translations for Previous, Next, etc. Why pagination doesn’t take language into account?
I couldn’t reproduce the issue. Try echo Yii::t(‘yii’,‘Next >’) and see what displays?
I wrote the following:
<?php echo Yii::t('yii', 'Please fix the following input errors:') . "<br>"?>
<?php echo Yii::t('yii', 'Next >') . "<br>"?>
<?php echo Yii::t('yii', 'Go to page: ') . "<br><br>"?>
The result was:
Por favor corrija los siguientes errores de ingreso:
Go to page:
The 3 messages are present in messages/es/yii.php. I have thought about file encoding, but both yii.php and admin.php (the file that has the problem) are encoded using UTF-8.
I attached my yii.php file.
Yes, that’s very strange. Your yii.php is fine. I copied your code to my site/index view (set language to be es before the code), but the three strings are all translated correctly.
What version are you using? Try it with the latest one or nightly build.
I have found the problem!!
The problem was the file version. I installed YII 1.0.7 some time ago. In that time, I copied the es/yii.php file to protected/messages/es. I don’t remember why, maybe because I planned to make some modifications.
Well, later I upgraded to YII 1.0.8 which does have the pagination messages. I forgot to copy that message file to my protected folder. I’m wondering why Yii 1.0.7 message file does not have those messages. Pagination doesn’t exist in 1.0.7 version?
Thanks a lot
Only translations for pagination didn’t exist in that version.