helpGNU gettext - Support: sr #102913, Wishlist: multilanguage support


sr #102913: Wishlist: multilanguage support

Submitted by:  None
Submitted on:  Sun 14 Mar 2004 05:51:22 PM UTC  
Votes:  2  
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  Done
Privacy:  Public Assigned to:  Bruno Haible <haible>
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 27 Oct 2018 01:10:06 AM UTC, comment #4:

Yes, as explained in comment #3, the solution for this use-case are per-thread locales, nowadays standardized through the POSIX functions newlocale, duplocale, freelocale, and uselocale. gettext supports these per-thread locales on all platforms where they exist, namely: glibc systems, Mac OS X, FreeBSD 11, Solaris 11 (OpenIndiana or 11.4 or newer; this is relatively new), and probably AIX 7.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Thu 28 Feb 2013 10:45:24 AM UTC, comment #3:

Actually, this is the main point for thread-specific setlocale(). You could run a thread for each user and set the locale to the selected one, while the main thread retains the system locale, but I think this should be done at Libc level.

Miguel Ángel Arruga Vivas <m1gu3l>
Project Member
Wed 24 Jan 2007 08:18:34 PM UTC, comment #2:

The problem with these language-swapping approaches - without really changing the locale with setlocale - is that you can produce inconsistent error messages:

fprintf (STDERR, _"open failed: %s\n", strerror (errno));

The string "open failed: %s\n" will be translated into a string of a language and encoding selected by the application. The interpolated string will be translated into a locale-dependent language and encoding. The mixing of languages is only mildly repulsive to the end user, the mixing of encodings can be fatal.

If you can live with that, write a hack like you described. If you can't live with it, there is no other way than really switching the locale with setlocale().


Wed 31 May 2006 07:36:49 AM UTC, comment #1:

Could the problem perhaps be solved (or circumvented) by storing the .mo's in locale specific subdirectories?


Other than that, I've longed for on-the-fly language swapping in KDE, Gnome and other software for a long time. As far as I can understand, this would/might open the door for such a thing (?).

Gudmund Areskoug <gudmund>
Sun 14 Mar 2004 05:51:22 PM UTC, original submission:

I writing a multilanguage server application. The user can select
the language of interface. If I want to use gnu gettext, I have to make
fake domain for all languages (messages_it.po, messages_fr.po, ...)
and select them using bindtextdomain and dc

Please, you could add some multilanguage functions like

dclgettext(id, domain, category, language)





(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by m1gu3l (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 2 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-27 haible Assigned toNone => haible
    2018-10-27 haible StatusNone => Done
        Open/ClosedOpen => Closed
    2006-05-31 gudmund Carbon-Copy- => Added gudmund

    Back to the top

    Powered by Savane 3.4