Talk:gettext

Latest comment: 4 years ago by MüffelSchnüffel in topic When was the first release?

Only about GNU gettext edit

This page seems to be only about GNU gettext, but has a generic gettext title. It should at least mention that gettext originated at Sun, and is still used by Sun's software and OS. The portable environment variable is named LANG, not LANGUAGE, the latter being a GNU extension with certain additional features.

I changed it to GNU gettext for now. If a generic gettext page is later made, this can be merged back in. Superm401 - Talk 00:01, 8 September 2008 (UTC)Reply
  Done This is now a generic page and not only GNU specific. The article has been renamed to gettext. Wget (talk) 22:01, 25 June 2016 (UTC)Reply

LANG and LANGUAGE? edit

What is the difference between LANG and LANGUAGE? This is not defined in the gettext manual http://www.gnu.org/software/gettext/manual/html_mono/gettext.html

The proper variable which refers to translation only is neither but LC_MESSAGES. LANG is a very generic (mostly historic despite being most known) variable which affects also the character set, the date format and others. This is especially problematic as LANG often unnecessarily implies something inferior to UTF-8. --82.141.49.90 16:49, 9 January 2007 (UTC)Reply
Replying to an old comment for clarity's sake. Here's what the ABOUT-NLS file (distributed with gettext) says:

Not all programs have translations for all languages. By default, an English message is shown in place of a nonexistent translation. If you understand other languages, you can set up a priority list of languages. This is done through a different environment variable, called `LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' for the purpose of message handling, but you still need to have `LANG' set to the primary language; this is required by other parts of the system libraries. For example, some Swedish users who would rather read translations in German than English for when Swedish is not available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.

80.233.255.7 23:58, 29 October 2007 (UTC)Reply

Thread safe edit

It reads on this article that gettext isn't thread safe! But it is locales that aren't thread safe! I'm removing the whole sentence. 80.244.73.230 22:47, 21 October 2007 (UTC)Reply

MIME type edit

Is there any MIME type for .po files? I have seen text/x-po used, but I want to know if there is anything (semi-)official.

Portable Object edit

Some articles link to this one for a discription of PO = portable object, but PO is not mentioned here. Maybe it should be. --LA2 (talk) 02:18, 7 January 2008 (UTC)Reply

Merger from msgfmt edit

Any objections to merging the content from msgfmt into this article and leaving that as a redirect to here? That article has forever been only a 2-sentence stub and almost could be deletable for lack of asserted notability. Is there anything major to say about that utility, and is it so important on its own vs just being a component of the gettext system? DMacks (talk) 19:44, 4 July 2008 (UTC)Reply

How to update a .po file edit

It should be interesting to present not only how to create, but also how to update a .po file. http://live.gnome.org/TranslationProject/SvnHowTo shows these steps: intltool-update xy ; vi xy.po ; msgfmt -cv -o /dev/null xy.po —Preceding unsigned comment added by 82.238.108.175 (talk) 17:03, 25 February 2009 (UTC)Reply

History, background and perspective edit

It would be nice to have some background story available. Initially, POSIX provided no means of localizing messages. Then, some time in the late 1980's, two proposals emerged: in 1988, the X/Open consortium specified the catgets() interface in the X/Open Portability Guide Issue 3 (XPG-3), where the messages are indexed by an integer, and in 1989, the UniForum group specified the gettext() interface, where the messages are indexed by string constants. Sun Microsystems was the first to implement the gettext interface in their SunOS, but for a long time, most commercial Unices offered support to both interfaces. The gettext() specifications eventually became part of POSIX.1b in 1993. — Preceding unsigned comment added by Peterlin~enwiki (talkcontribs)

Translator comments edit

The article uses /// to indicate translator comments. This is probably OK but why does the comment also start with " TRANSLATORS:"? This could be used as keyword instead of /// (multiline C-style comments would be required in this case). —Preceding unsigned comment added by 139.20.52.73 (talk) 11:21, 9 July 2010 (UTC)Reply

To make it easier and more convenient to parse, Gettext uses "///" to tell whenever to add the comment to the translation file.
The "TRANSLATORS:" part is redundant. I think it's here to make a example on a situation on how it might be used for.
Take note however that the talk page is to talk about the article only. So don't talk about the subject. Karjam, AKA KarjamP (talk) 11:35, 23 June 2012 (UTC)Reply

Incorrect output for example given edit

I'm just starting with gettext and the like, but I've noticed that if I run gettext with the options given in the example, i.e. run "xgettext --add-comments=/", then the pot (and po) content will include the leading '/' used as the comment tag. I.e. I get:

#. / TRANSLATORS: Please leave %s as it is, because it is needed by the program.
#. / Thank you for contributing to this project.
#: src/name.c:36
msgid "My name is %s.\n"
msgstr ""

I have no idea if this is an error here in the article, or if this behaviour may occur for some version(s) of gettext.

It's also the case that, in the case of a continuous set of single-line comments, the tag is only needed on the first single-line, and not on the subsequent lines. Logical, of course, and this means that it's not necessary to add the tag to each line, as in the example (which could imply that it's necessary). You could have:

/// TRANSLATORS: Please leave %s as it is, because it is needed by the program.
// Thank you for contributing to this project.
printf(_("My name is %s.\n"), my_name);

..for an output of:

#. / TRANSLATORS: Please leave %s as it is, because it is needed by the program.
#. Thank you for contributing to this project.
#: src/name.c:36
msgid "My name is %s.\n"
msgstr ""

Phylasnier (talk) 17:57, 22 August 2014 (UTC)Reply

The example given in the article("TRANSLATORS: Please leave %s as it is, because it is needed by the program." "Thank you for contributing to this project.") is ridiculous. Nobody will set such a comment. It is best to find a comment from a real life open source project. Otherwise perhaps a comment such as "%s contains the user's name as specified in Setting Dialog" or something like that. Kotz (talk) 08:12, 14 January 2019 (UTC)Reply

When was the first release? edit

The infobox claims it was 1990, its reference suggests it was 1987, the History-section says “Sun Microsystems implemented the first gettext in 1993.”. --MüffelSchnüffel (talk) 03:23, 7 March 2020 (UTC)Reply