1
Q: Why is libintl-perl so big? Why don't you use Encode(3pm) for character
2
set conversion instead of rolling your own version?
4
A: Encode(3pm) requires at least Perl 5.7.x, whereas libintl-perl needs
5
to be operational on Perl 5.004. Internally, libintl-perl uses Encode(3pm)
9
Q: Why do the gettext functions always unset the utf-8 flag on the strings
12
A: Because the gettext functions do not know whether the string is encoded
13
in utf-8 or not. Instead of taking guesses, it rather unsets the flag.
16
Q: Can I set the utf-8 flag on strings returned by the gettext family of
19
A: Yes, but it is not recommended. If you absolutely want to do it,
20
use the function bind_textdomain_filter in Locale::Messages for it.
22
The strings returned by gettext and friends are by default encoded in
23
the preferred charset for the user's locale, but there is no portable
24
way to find out, whether this is utf-8 or not. That means, you either
25
have to enforce utf-8 as the output character set (by means of
26
bind_textdomain_codeset() and/or the environment variable
27
OUTPUT_CHARSET) and override the user preference, or you run the risk
28
of marking strings as utf-8 which really aren't utf-8.
30
The whole concept behind that utf-8 flag introduced in Perl 5.6 is
31
seriously broken, and the above described dilemma is a proof for that.
32
The best thing you can do with that flag is get rid of it, and turn
33
it off. Your code will benefit from it and become less error prone,
34
more portable and faster.
37
Q: Why does Locale::TextDomain use a double underscore? I am used
38
to a single underscore from C or otherlanguages.
40
A: Function names that consist of exactly one non-alphanumerical character
41
make the function automatically global in Perl. Besides, in Perl
42
6 the concatenation operator will be the underscore instead of the
46
Q: What is the advantage of libintl-perl over Locale::Maketext?
48
A: Of course, I can only give my personal opinion as an answer.
50
Locale::Maketext claims to fix design flaws in gettext. These alleged
51
design flaws, however, boil down to one pathological case which always
52
has a workaround. But both programmers and translators pay this
53
fix with an unnecessarily complicated interface.
55
The paramount advantage of libintl-perl is that it uses an approved
56
technology and concept. Except for Java(tm) programs, this is the
57
state-of-the-art concept for localizing Un*x software. Programmers
58
that have already localized software in C, C++, C#, Python, PHP,
59
or a number of other languages will feel instantly at home, when
60
localizing software written in Perl with libintl-perl. The same
61
holds true for the translators, because the files they deal with
62
have exactly the same format as those for other programming languages.
63
They can use the same set of tools, and even the commands they have
64
to execute are the same.
66
With libintl-perl refactoring of the software is painless, even if
67
you modify, add or delete translatable strings. The gettext tools
68
are powerful enough to reduce the effort of the translators to the
69
bare minimum. Maintaining the message catalogs of Locale::Maketext
70
in larger scale projects, is IMHO unfeasible.
72
Editing the message catalogs of Locale::Maketext - they are really
73
Perl modules - asks too much from most translators, unless
74
they are programmers. The portable object (po) files used by
75
libintl-perl have a simple syntax, and there are a bunch of specialized
76
GUI editors for these files, that facilitate the translation process
77
and hide most complexity from the user.
79
Furthermore, libintl-perl makes it possible to mix programming
80
languages without a paradigm shift in localization. Without any special
81
efforts, you can write a localized software that has modules written
82
in C, modules in Perl, and builds a Gtk user interface with Glade.
83
All translatable strings end up in one single message catalog.
85
Last but not least, the interface used by libintl-perl is plain
86
simple: Prepend translatable strings with a double underscore,
87
and you are done in most cases.