GETTEXT message catalog placement



Hi,

We're still having a few problems to agree on a plural forms in Arabic,
and I am trying to put together a test suit to test a number of plural
forms. The code that I put together to do this is below.

My understanding is that I have to:
1- mkdir po, and create POTFILES.in with an entry for the file name
2- run intltool-update --pot
3- Translate file.
4- put compiled file (msgfmt) in
/home/djihed/dev/plurals/testcase/po/LL/LCMESSAGES/testbin.mo
5- run program with: LC_ALL=LL ./testbin

(LL is a locale, such as "ar")
It fails to pick up the translated strings. I don't even know if it is
finding the .mo file or not.

What am I doing wrong? I would appreciate any pointers.

Thanks,
Djihed



#include <stdio.h>
#include <locale.h>
#include <libintl.h>
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
#define GETTEXT_PACKAGE "testbin"
#define LOCALEDIR "/home/djihed/dev/plurals/testcase/po"

int main()
{
        setlocale(LC_ALL, "");
        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);   

        int     i;
        char    inbuf[512];
        while(1)
        {
                fgets(inbuf, 512, stdin);
                i = atoi (inbuf);
                if (i < 0)
                        return 0;
                printf(ngettext("There is %d book in this library.",
                                "There are %d books in this library.",
                                i),
                                i);
                printf("\n");
        }
        free(inbuf);
        return 0;
}





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]