LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-18-2008, 11:51 AM   #1
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 58

Rep: Reputation: 24
Question gnu gettext limitation?


The program xgettext combines all equal strings in the source code into one output string for translation. This is normally what one would want.

BUT sometimes the same English string needs more than one translation, depending on context (one phrase for two concepts - not the same in translation). There seems to be no way. Correct?

Of course I could add an extra blank to distinguish the two cases, but I still wonder if there is a designed solution for this.

thanks
Mike
 
Old 12-19-2008, 01:54 PM   #2
traene
Member
 
Registered: Jan 2005
Distribution: Archlinux, Debian, Centos
Posts: 222

Rep: Reputation: 35
Can you give a specific example? I could imagine using gettext to internationalize your conosole programme.
 
Old 12-19-2008, 04:20 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
If you mean the case of "Edit" for instance (one for menu option, but also for window title etc) you can distinguish those by adding context. Check pgettext() or gettext() with |
 
Old 12-19-2008, 04:27 PM   #4
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 58

Original Poster
Rep: Reputation: 24
context sensitive translation

I had one example recently. The word "save" for a toolbar icon I translated to German "speich", but the same word in a menu item I translated to "speichern". The abbreviation was used for the toolbar because the full length word in German made the whole toolbar too long (all icons are spaced as far apart as the longest icon text requires). For the menu there is no length consideration.

There are many cases where one word is used for two meanings, needing two different words in another language. An example is the German word "Himmel" which can mean "heaven" or "sky" in English.

Gettext() has a method for doing this, but it is overly complex and requires header files to be copied from gettext.h and modified. I got around the problem by using "toolbar::save" for the toolbar and "save" for the menu, and then making a wrapper for gettext() that discards any text preceeding "::".
 
  


Reply

Tags
gettext



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Gettext with anjuta iusegnu Programming 1 08-31-2008 04:51 PM
Using Gettext with Anjuta iusegnu Programming 1 08-31-2008 07:24 AM
gettext and localization mifi Linux - Software 0 03-24-2006 07:02 AM
Help with Gettext Snouser Linux - Software 2 03-02-2006 11:41 PM
php 5.0.5 and gettext ziggie216 Linux - Software 0 11-10-2005 02:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration