Page MenuHomePhabricator

run i18n message checks in Jenkins
Closed, DuplicatePublic

Description

We should automate some of the checks that people perform during i18n review of our code.

Below I've included one by Erik Bernhardson that checks for missing i18n documentation.[2] The maintenance/language directory has several check* scripts[1]; I couldn't get its checkExtension.php to run, it references a $wgTranslateAC that was removed from extension Translate in 4651bd97f.

[1] https://git.wikimedia.org/tree/mediawiki%2Fcore/HEAD/maintenance%2Flanguage

[2] This is in the form of a git hook but I hope it's straightforward to turn it into a Jenkins job. (Its assumption that MyExtension has a MyExtension.i18n.php file is true for 150 of the 180 extensions I have locally.)

In .git/hooks/pre-review put the following:

#!/usr/bin/env php
<?php

// This file must have the executable flag set to work as a hook

// A hooks path is always /path/to/repo/.git/hooks/hook-name
$repo = dirname( dirname( dirname( realpath( $argv[0] ) ) ) );

include "$repo/Flow.i18n.php";

$missing = array_diff( array_keys( $messages['en'] ), array_keys( $messages['qqq'] ) );
if ( $missing ) {
        echo "Missing i18n messages:\n\t" . implode( "\n\t", $missing ) . "\n";
        exit( 1 );
}

chmod +x the new file.


Version: unspecified
Severity: enhancement

Details

Reference
bz55456

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:15 AM
bzimport set Reference to bz55456.
bzimport added a subscriber: Unknown Object (MLST).
Spage created this task.Oct 8 2013, 4:05 AM

Also note that sometimes an extension will have multiple i18n files. Eg: Translate

I did something like that with https://gerrit.wikimedia.org/r/#/c/5550/ it is failing though. Feel free to take over that patch or fix it up.

Bug 61509 was requesting such feature for mediawiki core and it has been fixed (via a grunt task invoking "banana" checker).

For the other repositories we need to integrate the javascript banana checker and write the appropriate Jenkins jobs, that is bug 64045.

Making this bug a tracking bug and setting appropriate blockers.

demon removed a subscriber: demon.Dec 16 2014, 6:05 PM
Danny_B renamed this task from run i18n message checks in Jenkins (tracking) to run i18n message checks in Jenkins.Jul 16 2016, 3:52 AM
Danny_B removed a project: Tracking-Neverending.
Danny_B removed a subscriber: wikibugs-l-list.
Nemo_bis rescinded a token.Jul 16 2016, 8:01 AM