new project: Huggle

new project: Huggle

Hello, on new project instruction I was sent to #mediawiki-i18n, in that channel I was sent here. I would like to request a set up of new project (huggle) so that we can manage translations through this wiki and make it easier for translators to translate interface. We are using

key:       value

format which is very easy to parse even by humans or machines and is very suitable for any translations. However I was told that this wiki is unable to parse this simple format. Parser for this format is a matter of 3 lines of code, but if you want I will write it. Thank you Petrb (talk) 15:17, 10 January 2014 (UTC)

Petrb (talk)15:17, 10 January 2014

Yep, please write it: as you chose an unsupported format, TWN has no resources to implement it (I tell you for your good :) ). As Nikerabbit mentioned, your format is similar to .properties files like:

# Messages for French (français)
# Exported from translatewiki.net
# Author: Nisard

index.quote=Que l'Amour s'introduise auprès d'elle sous le voile de l'amitié

so you can probably adapt https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FTranslate/HEAD/ffs%2FJavaFFS.php Even better if you can also commit a configuration patch after that (or after you pick a supported format); the format is documented but you can see e.g. [1] and [2] for the needed set of files/configs.

Whatever happens, please remember to keep this thread (and/or its summary above) up to date as regards the status of things and what the next steps are, so that it doesn't get stuck.

Nemo (talk)15:32, 10 January 2014
 
Edited by author.
Last edit: 15:35, 10 January 2014

here is the code, I have no idea what coding style you require, so feel free to reformat, it's obviously longer than 3 lines, because I add some comments and error checks too :-)

/*!
 * \brief Parses a line of translation text
 * \param line Line in ^key:\s*value$ syntax
 * \return array with 2 elements key and value or NULL in case that line can't be parsed
 */
function ParseLine($line)
{
    $colon_position = strpos($line,':');
    // check if there is colon in line
    if ($colon_position === false)
    {
        return NULL;
    }
    $key = substr( $line, 0, $colon_position );
    $value = substr ( $line, $colon_position + 1 );
    while ( strpos($value, " ") === 0 )
    {
        $value = substr ( $value, 1 );
    }
    return [ $key => $value ];
}
Petrb (talk)15:33, 10 January 2014

This doesn't look like a FFS to me, anyway please commit patches on gerrit.

Nemo (talk)15:34, 10 January 2014

no this is php.

anyway, where can I find documentation for that FFS format you talk about? this piece of french text isn't very self-describing. Thanks!

Petrb (talk)15:36, 10 January 2014

Petrb, are you still interested in working on this? Were the links above to other FFS not useful? Let us know if you get stuck at some point with the gerrit patches in Translate/translatewiki repos.

Nemo (talk)11:46, 21 February 2014

it seems easier if we just change the format to something what is sane and easy to parse, so from current list of formats supported by this extension, only properly supported format I found was XML, so I would probably go for that. What is next step, you can assume all our language files are XML now.

Petrb (talk)15:09, 24 April 2014
 
 
 
 

BUMP

Petrb (talk)13:58, 26 April 2014

Let's meet up during the hackathon. Nothing better for priority than in-person meetings.

Siebrand10:07, 8 May 2014