[Top][All Lists]

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

[Dlang] Internationalisation WIP

From: Adela Vais
Subject: [Dlang] Internationalisation WIP
Date: Wed, 2 Dec 2020 02:33:57 +0200


I am trying to write the code for internationalization. The functions I use
are the ones from C's parser flow (dgettext, setlocale, etc).

I never worked with gettext (as a bash command) before, and I have some
trouble understanding how I automatically generate the .mo files and put
them into /usr/local/share/locale (where the code from the
examples/c/bisthromatic hints they should be found). My understanding is
that from the .po files I have to generate .mo files, and these are used by
the programs generated with Bison.

If I try to run "sudo make install" in the po directory I get this error:

    /usr/bin/install: cannot stat './': No such file or directory
    installing ./ as /usr/local/share/locale/bg/LC_MESSAGES/

and so on for each language file. After the command, no files exist in the
LC_MESSAGES directories.
If I run make update-po or update-gmo, I also get errors for missing files.

If I create a .mo file by hand, using msgfmt, and then move it
into /usr/local/share/locale/<language>/LC_MESSAGES/, the output gets
translated as expected.

The second problem is that I expected dgettext to receive the argument
"bison-runtime", like in C, not "bison", as it happens now in D. If I use
"bison-runtime" the messages remain in English.

Here [1] (and also as attachments) is a work in progress for this task,
with the mention that examples/d/c/calc/calc.y is modified just for testing
reasons, it will not be changed in the official commit.

Example of output with LANG=ro_RO.UTF-8:
~/bison/examples/d/calc$ ./calc
5 +
5 5
1.4-2.0: eroare de sintaxă, end of line neaşteptat, aştept + sau - sau (
sau number
2.3: eroare de sintaxă, number neaşteptat



Attachment: 0001-added-dgettext.patch
Description: Source code patch

Attachment: 0002-added-a-temporary-test-in-examples-d-calc-calc.y.patch
Description: Source code patch

reply via email to

[Prev in Thread] Current Thread [Next in Thread]