Automatisation of translation(edit the translation like wiki

Discuss and coordinate development of mainline and user-made content translations.

Moderator: Forum Moderators

Post Reply
Khiraly
Posts: 114
Joined: October 22nd, 2003, 7:13 pm
Location: Hungary

Automatisation of translation(edit the translation like wiki

Post by Khiraly »

Hi!

Im creating a page web, for automatisation the translation. I have filled with the utranslated strings(308).

The idea is was, is not just me, who is translating the hungarian translation file. So for make the life easy, I have written a small page around it.

Here is the URL:
http://khiraly.homeunix.org/cgi-bin/wesnoth.cgi

Is it not done for now, but Im working on to implement the edit function.
Im writing in perl, using the template system.

Is it anybody who is interessing on? (for own translation file)

Cheers,
Khiraly
lala

Post by lala »

This looks great!
Idea's: if you could read-and-parse/save whatever lang.cfg file then it would be suitable for all languages to be edited on the web.
Also a sort on 'done' and 'still to do' would be handy

But you probably thought of these as well
Khiraly
Posts: 114
Joined: October 22nd, 2003, 7:13 pm
Location: Hungary

Post by Khiraly »

lala wrote:Idea's: if you could read-and-parse/save whatever lang.cfg file then it would be suitable for all languages to be edited on the web.
Also a sort on 'done' and 'still to do' would be handy
For now Im working on the basic functions(edit, export as .cfg)
And I have created for my co-person who is helping with the translation.

But if the other translator find this site usefull, so I will make possibilities to upload, and implement the functions requested.

Other side, the fileformat is the following:
nameOfTHeOption|text in english|text an another language|

So isnt advanced, and I must working to convert the .cfg file format to my file format ...(For now isnt really automatised, I have converted with vim manually)

Best regards,
Khiraly
llogiq

I think this would be quite helpful

Post by llogiq »

Having an easy way to improve the translation will allow for more contributors. Could you create this page for more languages?

converting between
nameOfTHeOption|text in english|text an another language|
and key="value" should be quite easy in Perl:

Code: Select all

my @input=split("\|", join("", <>));

while (@input>2) {
        my $name = shift @input;
        my $en = shift @input;
        my $tr = shift @input;
        print qq($name="$tr"\n);
}
And back is a little more complicated, but still manageable:

Code: Select all

sub readFileAtOnce {
        open FILE, "< @_[0]";
        my $file = join("", <FILE>);
        close FILE;
        return $file;
}

my $en = readFileAtOnce("english.cfg");
my $tr = readFileAtOnce($ARGV[0]);

my %en = ();
while ($en =~ /\s*([^=]*)=\"([^\"]*)\"/gm) {
        $en{$1}=$2;
}

my %tr = ();
while ($tr =~ /\s*([^=]*)=\"([^\"]*)\"/gm) {
        $tr{$1}=$2;
}

foreach (keys %en) {
        unless ($tr{$_}) { $tr{$_} = "XXX NOT THERE XXX"; }
}

foreach (keys %tr) {
        print "$_\|$en{$_}\|$tr{$_}\|\n";
}
Of course, this does not mitigate the problem of having the english texts spread through multiple data files. :?
Post Reply