[Mediawiki-i18n] Jenkins test for i18n messages

S Page spage at wikimedia.org
Mon Oct 7 19:25:38 UTC 2013


This git hook checks that there's a qqq message for every English message.
With a little enhancement it could be generalized to most extensions.

Can someone add a test like this to Jenkins? Would it go in
<
https://git.wikimedia.org/blob/integration%2Fjenkins-job-builder-config.git/HEAD/mediawiki-extensions.yaml
>

---------- Forwarded message ----------
From: Erik Bernhardson <ebernhardson at wikimedia.org>
Date: Wed, Oct 2, 2013 at 10:36 AM
Subject: [E2] i18n messages
To: E2 development team <e2 at lists.wikimedia.org>


I've noticed a recurrence of git reviews about missing i18n documentation,
to help solve these up front we could add a hook to git review (or git
commit if you prefer) that checks this at a basic level for us.


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, and anytime you do a git review with missing qqq it
should say:

git review
Custom script execution failed.
The following command failed with exit code 255

"/home/guy/Jobs/mediawiki/vagrant/mediawiki/extensions/Flow/.git/hooks/pre-review"
-----------------------
Missing i18n messages:
        flow-post-action-censor-post

-----------------------


Relatedly, there is a new patch in gerrit to fix that missing message that
made it through review.

Erik B.

_______________________________________________
E2 mailing list
E2 at lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/e2




-- 
=S Page  Features engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/mediawiki-i18n/attachments/20131007/6354fe40/attachment.html>


More information about the Mediawiki-i18n mailing list