Last modified: 2011-12-08 14:59:38 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33982, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31982 - LocalisationUpdate doesn't work well with languages with fallback
LocalisationUpdate doesn't work well with languages with fallback
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
LocalisationUpdate (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n, patch, patch-need-review
: 32873 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-27 04:49 UTC by Liangent
Modified: 2011-12-08 14:59 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
handle fallback sequence and load all fallback messages from the cache (924 bytes, patch)
2011-11-16 19:41 UTC, Umherirrender
Details

Description Liangent 2011-10-27 04:49:44 UTC
Scenario: zh-cn falls back to zh-hans, and we normally localize nothing in zh-cn (instead we localize stuff in zh-hans and wait for the automatic fallback).

LocalisationUpdate is depending on the LocalisationCacheRecache hook to integrate its own l10nupdate-*.cache patches into main l10n_cache. However after a message is updated in zh-hans (and the update is expected to be seen by zh-cn users) and caught in l10nupdate-zh-hans.cache and user is viewing zh-cn page, LocalisationCache::recache( 'zh-cn' ) is called and LocalisationCacheRecache is run with $code == 'zh-cn'. Since we localize nothing in zh-cn, l10nupdate-zh-cn.cache is (almost) blank, so nothing will be merged into $alldata by LocalisationUpdate extension. This means zh-cn users will not be able to see updates in zh-hans.
Comment 1 Liangent 2011-10-28 08:31:48 UTC
The easiest way to fix this can be adding a hook for extensions to modify raw message arrays and switching to it from the current one which modifies the processed, eg. merged with fallbacks, array in the extension.
Comment 2 db [inactive,noenotif] 2011-10-28 15:39:23 UTC
When recache, the fallback languages should also be recached.

Maybe there are only a small number of user with zh-hans on that wiki and than the language is not recached recently and than nobody see the new translation.

When a message update is not visible in zh-cn, it is visible in zh-hand on that wiki?
Comment 3 Liangent 2011-10-28 16:39:03 UTC
(In reply to comment #2)
> When recache, the fallback languages should also be recached.

Is this true? It seems the fallback language messages are just fetched with $this->readPHPFile().

> Maybe there are only a small number of user with zh-hans on that wiki and than
> the language is not recached recently and than nobody see the new translation.

This is true. zh-hans and zh-hant conversion tabs (it's in the language converter, not the normal i18n system) are even hidden by default on zhwiki.

> When a message update is not visible in zh-cn, it is visible in zh-hand on that
> wiki?

Yes, it is.
Comment 4 db [inactive,noenotif] 2011-11-05 13:02:15 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > When recache, the fallback languages should also be recached.
> Is this true? It seems the fallback language messages are just fetched with
> $this->readPHPFile().

It should, but I am not sure, if it done at the momement.
Comment 5 Umherirrender 2011-11-16 17:53:31 UTC
This seems only affects messages of extensions.

On recache all fallbacks also recached.

It works for core. When a message is changed in 'de', it is also updated in 'de-formal' (which has fallback = 'de').

But for extensions it does not work. The new messages for CategoryTree are only updated for 'de', not for 'de-formal' (for example: [[MediaWiki:Categorytree-num-pages/de]] and [[MediaWiki:Categorytree-num-pages/de-formal]])

But I have no idea, why.
Comment 6 Umherirrender 2011-11-16 19:41:15 UTC
Created attachment 9476 [details]
handle fallback sequence and load all fallback messages from the cache

Messages from files in $wgExtensionMessagesFiles are stored with all fallback messages inside the LocalisationCache (at least with 'en'). Messages from core are only stored with one fallback (the fallback of the language from the message file), but not the whole sequence.

For this reason the LocalisationUpdate must also follow the fallback and has to get the cache from each fallback language. I have attached a patch to fix this.

Feel free to modify the patch.

Thanks.
Comment 7 Roan Kattouw 2011-11-17 11:42:35 UTC
(In reply to comment #6)
> Created attachment 9476 [details]
> handle fallback sequence and load all fallback messages from the cache
> 
Thanks for your patch. I will review it on or before Monday.
Comment 8 Roan Kattouw 2011-11-20 15:27:19 UTC
Patch committed with an important modification (reversing the fallback array). As submitted, this patch would cause the fallback to override the original language, meaning that on e.g. abwiki most messages would be in ru and the ab translations would be ignored, oops :D
Comment 9 Umherirrender 2011-11-20 18:59:46 UTC
Thanks.

I have copy the idea from LocalisationCache::mergeExtensionItem.
Comment 10 Liangent 2011-12-08 14:59:38 UTC
*** Bug 32873 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links