You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar code exists in our Translate fork, but upstream now uses getPageLanguage, so it makes more sense to just set up a PageContentLanguage hook in our LocalSettings like so:
Translate actually has two PageContentLanguage hooks. The one I mentioned before is for NS_TRANSLATIONS (also used by default on NS_MEDIAWIKI and wfAddNamespace namespaces, but not on our wiki).
There's a second hook for page translation, which handles translation subpages in NS_MAIN and others. Sadly the order in which hooks run is kind of undefined (the docs say wgHooks run before the 1.25 extensions.json hooks, but they also tell to not rely on it), which means we can't use the hooks above, because they may override the Translate hook.
We do actually modify the said hook with something like the above, so currently everything is already set up corretly. (source)
Do note that it's filtered with isSourcePage, meaning that a page that is not marked for translation is considered English. We could actually use that to make the hook order-independent (when we remove that patch from Translate, that is).
However, MW 1.24+ has a better solution: you can simply go to Special:PageLanguage, and change the page content language of a page (has to be enabled with $wgPageLanguageUseDB = true;).
So it looks like we can replace all the NS_MAIN ? 'ja' : 'en' hacks with page content lang in both TPC and Translate.
By the way, this is how we would migrate on MW 1.24
UPDATE page INNER JOIN revtag on rt_page = page_id AND rt_revision = page_latest
SET page_lang ='ja'WHERE page_namespace =0AND rt_type IN ('tp:mark', 'tp:tag');
Similar code exists in our Translate fork, but upstream now uses getPageLanguage, so it makes more sense to just set up a PageContentLanguage hook in our LocalSettings like so:
Should probably not run this hook when Translate's own hook is activated (
in_array( $namespace, $wgTranslateMessageNamespaces );
)The text was updated successfully, but these errors were encountered: