Pagination translate

I’m using Yii 1.1.1, Now want to make the default pagination words show another language, how can I do that?

Because the default word were EN.

Depending on how you are using the pagination, you can set the button-labels of the pager that renders the pagination. For example:

<?php $this->widget('zii.widgets.CListView', array(



   'pager' => array(

     'nextPageLabel' => 'Next',

     'prevPageLabel' => 'Previous',

     'firstPageLabel' => 'First',

     'lastPageLabel' => 'Last'


 )); ?>

What I using is like this:

$dataProvider=new CActiveDataProvider('product', array( 

                                                 'criteria' => array(

                                                   'order' => 'id DESC',






Is there a way to set the ‘Next’ ‘Prev’ or ‘Displaying 1-3 of 3 result(s)’ to another language?

set the ‘language’ property in your config and the labels should get translated automatically.

Thank you very much, I have follow the guide language translate, but there’s a problem in paginate, ‘Displaying 1-1 of 3 result(s).’ this setence can’t be translated even I add in the target language file.

that is because the zii components aren’t translated in all languages available in yii.

You can make the translations and add them in /protected/messages/<your language>/zii.php (look at the german language for example).

also you can set the ‘summaryText’ property like you did with ‘lastPageLabel’ => ‘Last’

and give it the text you want.

There are the recognized tags you can use in your translation: {start}, {end} and {count}

Of course if you will not use the pagination only {count} will be used

Thank you very much, it fixed!

Where I should use it? I wanna do pagination for my front-end page which is the main/Site controller

Instead of setting by force the labels of zii.widgets.*, the best option would be to use the default translation. If this translation doesn’t exist, adding it would be a nice way to contribute to Yii.

I thought all this would take just a few minutes. I set ‘language’ => ‘fr’ in the app config and some messages where already translated. I then translated “messages/fr/zii.php” (“php yiic.php message messages/config.php” built it). But it doesn’t work, the zii translation is not used.

So I tried to use the already translated language "de", but I still get "Displaying 1-30 of 3066 result(s)." for

Yii::t('zii','Displaying {start}-{end} of {count} result(s).');

The "yii" messages are alright, "next" becomes "Nächste". I spent an hour trying several configuration options and looking for doc or examples, without any luck till now.

To sum up, setting the “language” of the application translates “yii” messages, not “zii”. I don’t know if it’s a bug or if I missed something.

Check for available but not yet released translations here


I humbly think that your message is a bit off-topic. The problem is not the lack of translation, it’s how to make them work.

After tracing a bit the code, it seems the "yii" messages are always read in the framework path, whereas "zii" messages are always read in the application path. So Yii ignores its own translation files, like "yii/framework/messages/de/zii.php" in Yii 1.1.1.

Is there a way to make Yii behave as expected? I mean, read its own messages “framework/messages”, then look for local translation “protected/messages”. Or at least, make Yii always use “framework/messages”. I guess I’ll open a bug ticket…

I agree. For some reason I missed your post 01:07 PM. My response was intended for Mrsome1 (and possibly others, until next Yii release).


I’m think the correct order is:

1st: local translation "portected/messages"

Then look at "framework/messages"

This way if you want to provide a better (customized) transaltion instead of the “officials” ones (i.e. “framework/messages”), you will have’nt any problem

I opened a bug ticket for this.

BTW, I was clumsy in my last post, but I meant that I’d like “protected/messages” to overload “framework/messages” by using some kind of “array_merge()”. One could then provide partial localization for its own application. It would be great if the bug fix could bring this new feature.