#include <stdlib.h>
#include "i18n.h"
-const char *gettextdbg(const char *c)
-{
- char *c2 = gettext(c);
-
- if (strcmp(c, c2));
- return c;
-}
-
const char *sgettext(const char *msgid)
{
const char *msgval = gettext(msgid);
if (msgval == msgid)
{
- msgval = strrchr(msgid, '^');
- if (msgval == NULL)
- msgval = msgid;
- else
+ if ((msgval = strrchr(msgid, '^')))
msgval++;
+ else
+ msgval = msgid;
}
return msgval;
}
else
{
static char e[25];
+
/* set the LANGUAGE env variable */
strcpy(e, "LANGUAGE=");
strncat(e, language_codes[l - 1], 25 - 9);
putenv(e);
}
- setlocale(LC_ALL, ""); /* force to update getext */
+
+ /* Force to update gettext. */
+ setlocale(LC_ALL, "");
}
int language_count(void)
int language_from_code(const char *code)
{
int i;
- for(i = 0; i < LANG_NUMBER; i++)
- if (strcmp(language_codes[i], code) == 0)
- return i + 1;
+
+ for (i = 0; i < LANG_NUMBER; i++)
+ if (strcmp(language_codes[i], code) == 0)
+ return i + 1;
+
return 0;
}
const char *language_get_code(int id)
{
- if (id > 0)
- return language_codes[id - 1];
- else
- return "";
+ return id > 0 ? language_codes[id - 1] : "";
}