Locale and FAQ

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Locale and FAQ

Postby rigao » 04 Oct 2009, 16:47

Is it possible to translate xboard to other languages?

What i recall about its source code is that the menus where hard-coded so I guess it is not possible at the moment. If so, I would love to know if there is a plan to make it possible. Right now I do not have much time, but if everything goes its way, i would be able to do the dirty work in the future if there is interest. I would love to have xboard in catalan, and I would be able to translate it to spanish aswell, but the hardest work would be to enable the locales.

What I will certainly do is a FAQ on how to install xboard and get some tihngs working (Rybka and ICS mainly) because I have two computers that will need a clean install of ubuntu, and i will lose my configuration, and as it happens rather usually in my case, I want to have a reference guide on how to install xboard and make the appropriate launchers. So if only for myself, I will do it.

So, if there is actually a FAQ not terribly outdated, some1 could point it out, so I just use it as a reference. After that, I will surely post my little FAQ right here, and then its the community (I mean H.G.Muller) decision, if it is interesting to host it somewhere in the official page (of course with every change you like) or just ignore it. :-) Everyting will be fine with me.
rigao
 
Posts: 63
Joined: 14 Dec 2008, 17:33

Re: Locale and FAQ

Postby matematiko » 04 Oct 2009, 18:23

I had made tutorials in the past (more specically in the use of our ICS emulator YaY, long time ago on how to make CTG books and such), and let me tell you it is a time consuming job, therefore I woudnt be surprised if nobody steps in to create the tutorial you are asking for. Anyway, that been said, I second your motion, it will be very nice if someone does. Few weeks ago I embarked in the task of playing in Yahoo Chess server the same way I do it in Windows, which is by the use of:

Yahoo Server<->YaY (an ICS emulator)<->WinBoard<->Polyglot<->Rybka

In Linux I was able to:
- make YaY work (few perl code changes requiered)
-Compiled xboard and run it
-Run Rybka 3 x64 with microwine
-Compiled polyglot

But when all put togethere it did not work. I suspect the culprit is me, lol. I used the polyglot I compiled as well as polyglot_linux that comes with the Fabian's original polyglot's distribution (1.4w). More than likely I have the wrong engine launching parameters in polyglot.ini and/or xboard.

It somebody can write a tutorial, it will be fantastic.

Cheers,
One that does not live to serve, does not deserve to live.
matematiko
 
Posts: 219
Joined: 07 Dec 2008, 17:11
Location: Texas

Re: Locale and FAQ

Postby F. Bluemers » 04 Oct 2009, 18:32

matematiko wrote:I had made tutorials in the past (more specically in the use of our ICS emulator YaY, long time ago on how to make CTG books and such), and let me tell you it is a time consuming job, therefore I woudnt be surprised if nobody steps in to create the tutorial you are asking for. Anyway, that been said, I second your motion, it will be very nice if someone does. Few weeks ago I embarked in the task of playing in Yahoo Chess server the same way I do it in Windows, which is by the use of:

Yahoo Server<->YaY (an ICS emulator)<->WinBoard<->Polyglot<->Rybka

In Linux I was able to:
- make YaY work (few perl code changes requiered)
-Compiled xboard and run it
-Run Rybka 3 x64 with microwine
-Compiled polyglot

But when all put togethere it did not work. I suspect the culprit is me, lol. I used the polyglot I compiled as well as polyglot_linux that comes with the Fabian's original polyglot's distribution (1.4w). More than likely I have the wrong engine launching parameters in polyglot.ini and/or xboard.

It somebody can write a tutorial, it will be fantastic.

Cheers,

Thats a long string of possible mishaps : Yahoo Server<->YaY (an ICS emulator)<->XBoard<->Polyglot<->Rybka
as a matter of fact its even longer: Yahoo Server<->YaY (an ICS emulator)<->XBoard<->Polyglot<->microwine<->Rybka
you'll have to look at smaller parts :D
F.I. can you
a) Play a game (Xboard) <> xboard engine)
b) Play a game (XBoard<->Polyglot<->microwine<->Rybka)
etc.
Last edited by F. Bluemers on 04 Oct 2009, 18:39, edited 1 time in total.
F. Bluemers
 
Posts: 175
Joined: 04 Sep 2008, 16:56
Location: Netherlands

Re: Locale and FAQ

Postby H.G.Muller » 04 Oct 2009, 18:35

The situation for WinBoard and XBoard is quite different. In both cases all strings are hard-coded in the program. But XBoard uses the GNU gettext system for internationalization. In this system all translatable text strings are marked by enclosing them in _() or N_(). There then is software to extract all strings into a so called pot file, which is a template for the translation.

A human translator would then have to fill in the translated strings in the pot file, to make it into a so called .po file for a specific language. Once that is done, a national version of XBoard can be generated from the .po file and the normal sources. The .pot file for WinBoard 4.4.0 is available, and included in the source distribution. There are even partial translations for German and Turkish included. (The Turkish version is from 4.2.7, so the new features will remain untranslated.)

For WinBoard the situation is more complicated, as the texts for menus and dialogs are not hard-coded in a C program (as the are for XBoard in the file xboard.c), but are all inside the Windows resource file winboard.rc. This resource file is not C-code, and text strings cannot be marked in it with _(). So the GNU gettext system cannot be used on it. The files that are shared between WinBoard and XBoard, in particular backend.c, can of course benefit from the XBoard translation. But the text strings in there are not really very important or often seen. They fall mainly in 3 types:
1) Strings printed in the message field above the board, such as "xboard adjudication: checkmate", or warnings against common user faults, such as "it is white's turn", "Illegal move".
2) Messages that appear in error popups, most of which you would almost never see in normal use.
3) messages that go into the debug file.

I would say that (3) do not need translation at all, they are only there for the XBoard developers, and not for the users. For (2) only the most common errors probably need translation. Translation is really only important for group (1), which is fortunately quite small.

But that means that the GNU gettext translation is in itself far from sufficient to create the impression of a translated WinBoard: 90% of the texts the user is exposed to are in menus and dialogs. So for WinBoard it all hinges on the winboard.rc file.

Now I have developed a system to 'record' translations as an edit script. The edit script contains a number of substitute commands to replace text strings by there translated versions. It is not a fatal error if an original in the script no longer is present. And strings not mentioned in the script simply remain untranslated. So I can apply the script written for an earlier version without problems to updated versions of winboard.rc. This means translation efforts do not get lost on updates, and that we will not have to maintain a large number of national versions for winboard.rc for each change we make in it. We just make the change in the English 'master' version, and someone that wants to make (say) a Spanish version for a new WinBoard release can start by applying the old script to the new winboard.rc, to generate a Spanish version from it, before compiling WinBoard. This is as simple as typing the single command

./internationalize spanish.txt

befor doing the normal make command. Only new or modified menu and dialog text would then remain English, and by adding their translations to the spanish.txt file, the Spanish version would have been fully updated as well.

The file spanish.txt, recording the translation, consists of about 400 lines of the format:

"Bishop"=="Alfil"
"&King"=="&Rey"
"Fruit and &Vegetables"=="Frutas y &Verduras"

etcetera. I have a file "laguage.txt" available as template for translators (it can be downloaded from the XBoard git repository at the GNU-Savanah website), which contains an empty translation, like

"Bishop"==""
"&King"==""
"Fruit and &Vegetables"==""

A Spanish translation of winboard.rc is already in the making.

Of course translaying all text strings printed by WinBoard is just a minor job compared to translating the documentation (help file, man page). :(
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Locale and FAQ

Postby rigao » 05 Oct 2009, 12:25

Let me check if i understood correctly:

While to translate xboard (apart from the help files, which is indeed tons of work) you just need to translate the .po files in the "po" directory, to translate winboard you need to take a very different approach...

So to actually translate to spanish, you will need to translate both xboard and winboard separately, isn't it?

If there is a translation to spanish in winboard, I think i would be able to translate the xboard version, but will take me some time, as now I do not have much of it to spare.

Anyway, is there some plan to change this way of handling things? I mean, translate like this is not much efficient...

About the FAQ which I found in the sources of xboard, I must admit it is quite extensive and complete. I still have some minor ideas, mainly to add, which I will post here.
rigao
 
Posts: 63
Joined: 14 Dec 2008, 17:33

Changes in FAQ

Postby rigao » 05 Oct 2009, 15:10

Here is what i have done so far. It is not much, but I hope it helps. I will always refer to the FAQ in the source for xboard 4.4.0 beta. Any change from it, I haven't seen it. So sorry if it already changed.

The "[D] Crafty and other topics" section of the FAQ would be much better called something like "Coupling xboard with engines" or "Using engines under xboard". Because the engine world is big out of crafty ;)

In "[B.7] How do I build XBoard? Do I need gcc?" i would rename it to "Hot to install Xboard" and provide various methods. First of all, the method provided there does not work at all, because there is not configure file provided.

In this question I would rather do three subsections: installing under ubuntu, using the .deb package or installing from source.

Installing under ubuntu 9.10:

Installing under Ubuntu is quite easy. You just need to open a terminal and type:
Code: Select all
sudo apt-get install xboard

To further increase the xboard features as seen in [refer to questions about UCI and other engines] it is recommended to install polyglot
Code: Select all
sudo apt-get install polyglot

which will install also a UCI engine called fruit.

Other engines you might consider using are crafty (winboard engine) and toga2, a fork from fruit:

Code: Select all
sudo apt-get install fruit toga2 crafty


[Now it would be great to point the user to the question "How can I start xboard with engines"].


Installing xboard from source
Installing xboard from source is a little bit more complicated. This guide will cover the installation under Ubuntu 9.10. If you are using another distro, make sure to acknowledge the differences in packages names if any. You can find the source code in http://ftp.gnu.org/gnu/xboard/ . Download the version you want to install and untar it in wherever directory you want (say /home/user/Desktop). You will need to download also some packages to allow you to compile it. Namely g++, autoconf, xorg-dev flex and texinfo (for makeinfo).

After untaring the xboard source, you just need to follow this steps:

Code: Select all
cd /home/user/Desktop (or the directory you untared xboard in).
sudo apt-get install g++ autoconf xorg-dev flex texinfo
./autogen.sh
./configure
sudo make install


And voila, you will have xboard installed. To use it in the command line, just typing "xboard" will try to load fairymax engine, which normally you won't have installed. You can install it or just start any other engine as refered in [Reference to the question on how to start engines in xboard].





In the question on how to start engines, make sure it states that if the installation was made following the ubuntu 9.10 guide, then to call engines in xboard will be as simple as :

Code: Select all
xboard -fcp crafty
xboard -fcp fruit -fUCI
xboard -fcp toga2 -fUCI


¿Who said it was difficult to use UCI under xboard? This way, nobody will be scared of and complain about polyglot anymore. Simple, clean, piece of cake.

I
rigao
 
Posts: 63
Joined: 14 Dec 2008, 17:33

Re: Locale and FAQ

Postby burunduk » 07 May 2011, 17:24

H.G.Muller wrote:<...> a national version of XBoard can be generated from the .po file and the normal sources. The .pot file for WinBoard 4.4.0 is available, and included in the source distribution.


Is it still possible to translate xboard? The po directory doesn’t exist in the latest releases. It is easy to make new pot/po/mo files, but I have no idea about the configuration files.

Also encodings can be a problem. System-wide setting of any encoding other than utf-8 would cause too many troubles with other applications.
burunduk
 
Posts: 11
Joined: 14 Apr 2011, 02:54

Re: Locale and FAQ

Postby H.G.Muller » 07 May 2011, 21:46

As a matter of fact Arun just started working on that. Some recent commits (April 23) to the master branch in the git repository of the GNU XBoard website concern the generation of an up-to-date pot file, and finishing of the German po file he made himself. And I created a small script 'lng2po.sh' to apply the translation contained in a WinBoard .lng file to the new pot file, populating the translation for all the common strings, and a lot of equivalent strings. There are some strings that are unique to XBoard, though, and they will remain empty n this process. And of course in the mean time there are some new strings common to both because of the recent new features (Load Engine and Tournament and Match Options dialogs, Book Edit), some of which are not even in the pot file yet.

The WinBoard .lng files (including your Russian translation) were committed to the GNU repository 6 hours ago, in the winboard/langage directory of the source tree. The lng2po.sh script is still in the po directory, and assumes the WinBoard files are in po/winboard (where I had them before). So it would have to be changed a little. It is a very small script, though:

Code: Select all
cp winboard/$1 language.lng
recode latin-1 language.lng
ed language.lng < metascript
rm language.lng
cp xboard.pot language.po
ed language.po < script
rm script


In the new setup the "winboard/$1" would have to be replaced by "../winboard/language/$1", after which you could run it in the po directory through the command "./lng2po.sh russian.lng", which then would create a file "language.po", which should be the Russian po file in UTF-8. But I guess to make it work for Russian the "latin-1" in the script would also have to be replaced by the codepage used by russian.lng (latin-2?).
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Locale and FAQ

Postby burunduk » 09 May 2011, 18:30

OK, I didn’t find po directory because I’m not a developer and never look into the Git stuff.

Latin-2 is for Polish and Latin/Cyrillic is nonsense: “People over there think that bears are walking around on our streets carrying balalaikas and speaking in ISO 8859-5.” [1] I don’t know about recode but iconv works:

Code: Select all
cp language.lng tmp_file
iconv -c -f CP1251 -t UTF-8 tmp_file > language.lng


This doesn’t matter anyway. I’ve got a thousand of error messages from ed. And I can’t compile XBoard because I have a totally ancient gettext v. 0.17, whilst v. 0.18 is needed! My outdated and unsupported version of …®™ is not an obstacle for WB. Unfortunately, I won't be able to help; it is rather difficult to test the translation without a working copy of the program.

It is not the case with Ubuntu though. The main problem is that XBoard shows abracadabras in stead of Unicode strings. It is probably better to leave LINGUAS unmodified for a while.
burunduk
 
Posts: 11
Joined: 14 Apr 2011, 02:54

Re: Locale and FAQ

Postby H.G.Muller » 09 May 2011, 19:24

I seem to have the same problem on my Ubuntu 8.04, with gettext 0.17 vs 0.18. Since Arun switched on the gettext support, I cannot compile the release tar balls anymore. There seems to be a solution to that, though: run

gettextize -f

before the usual

./autogen.sh
./configure
make

should solve the 0.17 vs 0.18 problem. I think in the mean time Arun has switched off the gettext support again, becase it caused many problems for a lot of users.

Btw, Arun has applied the lng2po script to all the WinBoard .lng files, (which should include your Russian one) and reported no problems. But he reads no Russian, of course. Could you check if the ru.po that is in the tar ball of the latest development release at GNU makes sense? It could very well be just gibberish. In fact I think it is a bit suspect that under Linux' gedit it just looks like I print it in Windows using the wrong (Western Europe) code page. I didn't expect that in UTF-8.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Locale and FAQ

Postby burunduk » 09 May 2011, 22:38

The lng2po script from master-20110507 assumes that Latin-1 is the input file encoding. Thus all files with different initial encodings have been converted wrong way. This concerns po files for ru, zh-xx, vi, and tr. I don’t know what happened to ed on my Puppy, but the script worked well on Ubuntu 11.04 (iconv was used in stead of recode). I hope it's OK to bloat other people computers with link-time libraries.

I was able to compile XBoard on that box as well. But the Russian words in the main menu looked like a Unicode text shown in CP1252.

---

It was BusyBox, not a real ed! I converted the files in Geany and re-ran the script (without converting). Here is the result. (md5: e966b23681e356feacdca2e48e4d26b1)
burunduk
 
Posts: 11
Joined: 14 Apr 2011, 02:54


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 13 guests