getNamespaceBaseLanguage should be replaced with getPageLanguage

Open
#3 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
backend

Research direction

Locate the implementation of getNamespaceBaseLanguage and the LocalSettings setup, then compare it with the linked upstream Translate commit using getPageLanguage. Verify the PageContentLanguage hook behavior for non-main namespaces and Translate message namespaces; done means the old helper is replaced without conflicting with Translate's hook.

Written by the indexing model from the issue text.

Description

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:

$wgHooks['PageContentLanguage'][] = function( Title $title, &$pageLang, $userLang ) {
    global $wgLanguageCode;
    $pageLang = Language::factory( $title->getNamespace() !== NS_MAIN ? $wgLanguageCode : 'ja' );
}

Should probably not run this hook when Translate's own hook is activated (in_array( $namespace, $wgTranslateMessageNamespaces );)

Dominant language
PHP
Stars
7
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from thpatch/TouhouPatchCenter

All issues in thpatch/TouhouPatchCenter

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.