perl-i18n

Alternative catalogue format for maktext?

2002-04-28 11:00:36
Hi there. I'm localizing RT, and our catalog files looks like this:

    package RT::I18N::zh_tw;
    use base qw(RT::I18N);
    use strict;
    use vars qw(%Lexicon);
    %Lexicon = RT::I18N::parse( << '___' );
    # File: html/Admin/Groups/Members.html
    (No members)
    (SOME CHINESE COUNTERPART HERE)
    # File: lib/RT/Transaction_Overlay.pm
    (no value)
    (ANOTHER CHINESE STRING HERE)
    # File: html/Elements/CreateTicket
    # Vars: $ticket->id
    <input type="submit" value="New ticket in">&nbsp;[_1]
    CHINESE WITH HTML, LINE 1
    CHINESE WITH HTML, LINE 2
    ___

This catalog is incrementally generated from the source file and html
file itself, using <http://p4.elixus.org/depot/RT/l10n.pl>.

Now, the question is: Do you think this is a good enough format for
large catalogs? Our translator (well, me included) doesn't like to
deal with '' and => all the time, and the comment lines really helped
us getting to know the context.

Of course, this assume the hash key does not extend over several lines;
but if that's ever needed, adding a '# Line: 2' should solve this
problem quite easily.

Jesse Vincent comments that for latin-based target languages, visual
distinctions between the source and the target is needed. That is,
this is not very good:

    # File: Apache/MP3.pm
    Stream All
    Jouer tout

And this is better:

    # File: Apache/MP3.pm
    ! Stream All
    Jouer tout

What do you think? The idea is reducing the burden on translators
of understanding perl.

Of course, one could also use the gettext .po format, which might
be a much better solution. To wit:

    package RT::I18N::zh_tw;
    use base qw(RT::I18N);
    %Lexicon = __PACKAGE__->load(gettext => \*DATA);
    __DATA__
    #: lib/RT/Transaction_Overlay.pm:48
    msgid "(no value)"
    msgstr "(ANOTHER CHINESE STRING HERE)"

    package Locale::Maketext;
    sub load {
        my ($self, $method, $fh) = @_;
        $method = "load_$method";
        $self->$method(<$fh>); # or a string?
    }

This could be handled by RT::I18N::load_gettext, or fallback to
Locale::Maketext::load_gettext. That way it can accept msgcat or
other catalog formats, which is a win because we get to use existing
utilities designed for them, as well as re-using existing .po and
..m files.

Thoughts? :)

/Autrijus/

Attachment: pgpmWwfIRoH7P.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>