new project: Huggle
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 ];
}
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, 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.
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.