Refracta Development, Scripts, etc.
Post a reply

refractainstaller locale correspondence

Thu Jan 19, 2017 11:06 am

I want refractainstall to be added locale.

Desktop environments such as Xfce can accommodate locales,
but some users exclude use by English installer.

I want Refracta Japanese ISO. It can be realized using refractasnapshot.
but current installer is a problem.

Re: refractainstaller locale correspondence

Thu Jan 19, 2017 4:02 pm

I don't know how to do that, but I think dzz does know. Exegnulinux can use Spanish in the installer. If he doesn't see this and answer, I'll try to track him down.

Re: refractainstaller locale correspondence

Fri Jan 20, 2017 2:55 am

Basically, a text dialog line in a script with "$" in front of it (refractainstaller mostly has already) is automatically translated to the current locale, if the translation files exist. No other changes to the scripts are necessary.

The translator (thanks in advance, ballon!) will need to write and process the pot, po and mo files (containing the translations) and maintain them as and when the scripts update. There are gui utilities to help..

A basic understanding of "gnu gettext" is first needed. Start with installing "info" then read "info gettext".

Re: refractainstaller locale correspondence

Fri Jan 20, 2017 6:02 am

Thanks fsmithred and dzz. :D Exe is also on my PC, too. ;)

I know refractainstaller is made of Shell.
Probably there is no need to greatly improve the source.

Probably this response will be to adopt refractainstaller in other distributions.
Of course it is also useful for Refracta. :mrgreen:

We can correspond refractasnapshot as well.

Re: refractainstaller locale correspondence

Sun Jan 22, 2017 12:27 pm

It looks like the translations depend on a PO file, which contains the line number from the script, the untranslated text and the translated text. So, what I need to know is how I can screw that up. If I change the script by inserting or removing a line, does someone have to go and change all the line numbers in the PO file? Also, if I change the wording in a line of text, and the PO file does not get changed, does it still show the old translation for that line?

Re: refractainstaller locale correspondence

Sun Jan 22, 2017 2:07 pm

Usually it is handled per sentence.
If there is no change in the original sentence, translation will be maintained even if the source changes.
If the original sentence changes, it will be untranslated, and there will be many times to re-translate it again.
In that case, if not translated, the sentence will be returned to English. (Still it will be displayed)

These may vary depending on the system used.
Applications such as poedit are common for translation work.
Recently we can translate work on the web as well.

Re: refractainstaller locale correspondence

Sun Jan 22, 2017 9:18 pm

In the latest refractainstaller-yad script I found only 2 instances of a missing "$" before a text dialog. Far as I remember that was done a while back, to facilitate future translations. The yad "button" text would need sorting similarly. A script header, something like this, is probably needed:

Code:
TEXTDOMAIN=refractainstaller-gui
TEXTDOMAINDIR=/usr/share/locale/


Apart from that, the rest is the translator's job. There are around 150 strings to translate. I don't know how or if the configuration file should be done.

The cli script needs all the "echo" strings marked.

I used poedit before but mostly preferred the cli commands. This one dumps the marked strings to a template file:

Code:
bash --dump-po-strings /usr/bin/refractainstaller-yad >refractainstaller-gui.pot


You can open and edit it (better, a copy of) with a normal text editor or poedit. You then convert to the binary "*.mo" file which goes in e.g. /usr/share/locale/ja/LC_MESSAGES/ (could be in the main .deb, or packaged separately)

I only really know this stuff to an elementary level. I could maybe help more in a European language but don't even know the Japanese alphabet! However, balloon seems to be on the case already.

Re: refractainstaller locale correspondence

Mon Jan 23, 2017 2:18 am

I can provide Japanese .po files from .pot files. Of course it is also possible to check the display.
Should I try to generate a .pot file in addition to the source?

Re: refractainstaller locale correspondence

Mon Jan 23, 2017 12:44 pm

Should I try to generate a .pot file in addition to the source?

Yes, at this stage. The .pot is your "template", copy that as a .po and edit that. Work on a copy of the script (the official version isn't quite ready yet) with the header included near the top, as I posted earlier.

When you save the .po using poedit, it automatically generates the binary ".mo", which you can copy manually to the right place, for local testing.

Note: Get your .pot sorted and verified first. Your initial .pot will have problems with duplicate strings. I found a text editor easier than poedit to sort that. That is then the template for all other translations.

Good luck ballon and be prepared for a little rage during the learning curve!

Re: refractainstaller locale correspondence

Tue Jan 24, 2017 1:59 am

I tried it.

I have generated a pot file using xgettext:
Code:
xgettext -L shell -o refractainstaller.pot refractainstaller-yad

I translated some sentences with poedit from there:
Image

I added the code described by dzz to refractainstaller-yad. (I changed the path for testing)

as a result, Refractainstaller replaced me with Japanese display unexpectedly:
Image

I can translate the tool with this. Thanks dzz! :D
It seems easy to realize.
Post a reply