Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Is there a need for another module like Locale::Maketext/Locale::gettext

by SBECK (Hermit)
on Mar 13, 2013 at 14:21 UTC ( #1023209=perlquestion: print w/replies, xml ) Need Help??

SBECK has asked for the wisdom of the Perl Monks concerning the following question:

A while ago, I wanted to localize a perl script so I went to look at my options (mainly Locale::gettext and Locale::Maketext) and I wasn't satisfied with either.

My main concern is that, IMO (and this is without every having localized a program before, so this is sort of an outsider-looking-in perspective), I don't see how you can keep a set of translations up-to-date without per-message version information. I read most of the gettext documentation, and it seems to me that there is wonderful support for doing initial translations, but if you ever need to revise a message, then it's not obvious which translations are up-to-date at that point. Some trivial changes (i.e. correcting a typo for example) would not require that the translations be fixed, but if you added functionality requiring that a message needed to be updated, then all of the translations for that message are now out-of-date, but other messages in the lexicon would still be fine, and would not need to be revisited by a translator. I didn't see any tool which would allow me to look at a set of translations and distinguish between those that were current and those that were out-of-date.

Anyway, I may be missing something in my reading, but it just doesn't seem like the standard tools allow for this (though some external tool that I might have missed may have that functionality).

I briefly considered modifying Locale::Maketext, but I abandoned that quickly. The module is short (only a few hundred lines) and by the time I made the changes I wanted, there would be nothing left of the original.

So, I wrote my own module along with a simple GUI tool for maintaining translations, and I've been using it for a while and am really pleased with it. It makes it really easy to take a lexicon and see which messages are missing and need to be added, which are out-of-date with respect to the default, and which are current.

Since I've been very satisfied, I'm thinking I'd like to release it, but I wanted to get some feedback on whether I'm totally off the wall on what I perceive as a missing piece of the localization process.

  • Comment on Is there a need for another module like Locale::Maketext/Locale::gettext

Replies are listed 'Best First'.
Re: Is there a need for another module like Locale::Maketext/Locale::gettext
by zwon (Abbot) on Mar 13, 2013 at 14:38 UTC
    We using Locale::Maketext with Locale::Maketext::Lexicon at work, and yes there are some problems with it. As for gettext, it is simply not usable for multiuser applications. So if you have finally found the way to do it right and willing to share, then of course you shoud release it.

      Could you explain what limitation you are referring to when you say that gettext is 'not usable for multiuser applications'? Since I'm not sure exactly what limitation you are referring to, I'm not sure whether my module addresses that limitation or not. I like to have my modules be pretty complete in terms of what they can do, so if there's a weakness in gettext that I'm not aware of, I'm possibly interested in addressing it.

      For what it's worth, my module is very similar to Locale::Maketext in terms of how it's used in the program.

      I've been calling my module Locale::Messages, but that name's already in use, so I'll be renaming it and releasing it shortly.

        Gettext behaviour is controlled by global variables. So if a single process wants to serve several users with different languages, it has to set locale before each print. A simplest example is a web application -- if you set locale, it will affect not just output to the user, but also what application will write in the error log, and generally people don't want to deal with a mix of languages in their logs.
Re: Is there a need for another module like Locale::Maketext/Locale::gettext (no)
by Anonymous Monk on Mar 14, 2013 at 03:40 UTC

    I think answer to the question in the title is no, since that is kind of the job of frontends like

    So you would use gettext with a versioned domain like myapp-1.0, if you need to know what keys are new/need updating, the translator compare versions in the frontend

    But you also wrote a frontend, so yeah, I think you should release it

    But I have little experience with i18n

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1023209]
Approved by zwon
Front-paged by toolic
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2020-10-21 13:38 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (217 votes). Check out past polls.