[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA: [OT] gettext_noop(): problem with empty strings
- To: geda-dev@xxxxxxxx
- Subject: gEDA: [OT] gettext_noop(): problem with empty strings
- From: Werner Hoch <werner.ho@xxxxxx>
- Date: Sat, 26 Mar 2005 16:12:16 +0100
- Delivered-to: archiver@seul.org
- Delivered-to: geda-dev-outgoing@seul.org
- Delivered-to: geda-dev@seul.org
- Delivery-date: Sat, 26 Mar 2005 10:12:56 -0500
- Reply-to: geda-dev@xxxxxxxx
- Sender: owner-geda-dev@xxxxxxxx
- User-agent: KMail/1.6.2
Hi all,
geda contains untranslated strings. The strings are in structs and there
are empty entries:
char * text[] = {"text1", "", "blablub" };
the info pages of gettext tells, that I have to use the gettext_noop()
macro or the short form N_() of it:
char * text[] = {N_("text1"), N_(""), N_("blablub") };
When I use the strings:
for (i=0; i<3; i++)
printf("%s\n", gettext(text[i]));
the translation fails for the empty string because
gettext("");
will return the header of the po file including the translator the
translation date and so on.
There's a workaround for empty strings. Just don't translate if the
string is empty:
for (i=0; i<3; i++)
printf("%s\n", strlen(text[i]) ? gettext(text[i]) : text[i])
Is there an easier solution for that problem?
regards
Werner