Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


GettextMessageSource: added category name to cache key #1997

merged 1 commit into from

3 participants


fix: added category name to cache key, because messages are set to cache by category.
fix problem: when we use many categories in pofile and use cache, framework sets messages to cache from one category and the next time (from other category) gets messages from cache form wrong category.

@cebe cebe was assigned

What about language?


a file name is used to build cache key and for another language another file will be used

$messageFile=$this->basePath . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . $this->catalog;

@samdark samdark referenced this pull request from a commit
@samdark samdark added changelog line for #1997 bfe991e
@samdark samdark merged commit af55448 into from

Merged. Thanks for fixing it.


Thanks you ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2013
  1. add to cache key category

    devyatkov authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  framework/i18n/CGettextMessageSource.php
2  framework/i18n/CGettextMessageSource.php
@@ -91,7 +91,7 @@ protected function loadMessages($category, $language)
if ($this->cachingDuration > 0 && $this->cacheID!==false && ($cache=Yii::app()->getComponent($this->cacheID))!==null)
- $key = self::CACHE_KEY_PREFIX . $messageFile;
+ $key = self::CACHE_KEY_PREFIX . $messageFile . "." . $category;
if (($data=$cache->get($key)) !== false)
return unserialize($data);
Something went wrong with that request. Please try again.