From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Free Software / Software / Computing   
WikiProject icon This article is within the scope of WikiProject Free Software, a collaborative effort to improve the coverage of free software on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software.
Taskforce icon
This article is supported by WikiProject Computing.

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)
Yes check.svg 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)

LANG and LANGUAGE?[edit]

What is the difference between LANG and LANGUAGE? This is not defined in the gettext manual

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. -- 16:49, 9 January 2007 (UTC)
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'. 23:58, 29 October 2007 (UTC)

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. 22:47, 21 October 2007 (UTC)

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)

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)

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. shows these steps: intltool-update xy ; vi xy.po ; msgfmt -cv -o /dev/null xy.po —Preceding unsigned comment added by (talk) 17:03, 25 February 2009 (UTC)

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.

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 (talk) 11:21, 9 July 2010 (UTC)

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)

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)