CakePHP cache i18n translate

2019-02-18 00:52发布

When I forget to translate something, somewhere Project VIEW, I change the file /app/Locale/por/LC_MESSAGES/default.po and sending it back to the server.

But mostly, this 'new translation', takes HOURS to be viewed, in short: I just send the file, cleaned the cache and browser CakePHP, press F5, and ... NOTHING HAPPENS.

For what reason?

[EDIT]

<?php echo $this->Form->input('Item.0.description', array('label' => false, 
'class' => 'span12', 'div' => array('class' => 'span7'), 'rows' => 3,
'placeholder' => __('Type the description'))); ?>

3条回答
叛逆
2楼-- · 2019-02-18 01:38

I found a strange solution:

I set (app/Config/core.php)...

Configure::write('debug', 2); // It was 0

Press, F5... wait... and works. Later, I back...

    Configure::write('debug', 0);

Press F5 again, and works.

Why? I no have idea.

查看更多
相关推荐>>
3楼-- · 2019-02-18 01:40

Even if Configure::write('debug', 2); I recommend to delete the remote folder containing the translations, refresh with browser (to state that nothing is translated anymore) then reupload the translations folder.

Works perfectly that way for me.

查看更多
淡お忘
4楼-- · 2019-02-18 01:42

To force the language to update you can empty the persistent and models directories in the /tmp/cache directory. If view caching is enabled you'll have to clean out views as well.

Caching is disabled when debug is set to 2 (which is the value for using the framework during development) and the persistent directory is populated with new cache files, overwriting the old ones, each time a view is loaded. So the debug switch and subsequent browser refresh might cleaned the old language files for you.

查看更多
登录 后发表回答