Little story about I18n.php and translation logic

Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Thu, 2012-02-02 04:58

I have had Russian translation working just fine for one of the users of my gallery until few months ago.
Well, I was not notified about an error which begun to happen

OK, let's see - set default language for myself to Russian and BOOM! error which kills admin... now I cannot restore to original state...

ErrorException [ 0 ]: unserialize()
[function.unserialize]: Error at offset 37 of 74 bytes gallery3/modules/gallery/libraries/Gallery_I18n.php [ 176 ]
#0 [internal function]: gallery_error_Core::error_handler('s:31:"?????????...')
#1 gallery3/modules/gallery/libraries/Gallery_I18n.php(176): unserialize('ru_RU')

was working before! what happen!
OK, go to xx_users table and set my locale back to en_EN... refresh... and we are back in business... relief!

OK, I went in admin and updated translations cache... same issue...
then I looked at nice table called `xx_incoming_translations` and... s***t... some translations are OK and some are in gibberish...
Ah-ha!!! OK, let's delete all records for the locale and sync again (unfortunately one need to have direct access to DB to do that)... change default locale... refresh... and... WOW! Everything still working...

Conclusion:
* When allowing use of other languages do not try it on main account, can loose the admin access. Or prepare to be able modify DB directly
* as it was said on several occasions, I18n implementation is not very stable or error resistant - can bring whole site down
* G3 team need to consider spending some time in that area to make to rock solid and keep in mind that any modifications in encoding of translation data in DB need to be accompanied by full reload of the cache.