xboard-devel
[Top][All Lists]
Advanced

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

Re: [XBoard-devel] WinBoard internationalization


From: h.g. muller
Subject: Re: [XBoard-devel] WinBoard internationalization
Date: Thu, 17 Sep 2009 20:32:06 +0200

I now completely automated the process of translating the WinBoard resource.
Given a file that contains the translation as a number of rules,

"original message"==="translated message"

for wich I have a template available with lines

"original message"===""

for all text strings occurring in wonboard.rc, ordered by dialog, with some comment lines interspersed. Translators can use this template "language.txt" to record a translation for a specific language, say "spanish.txt". All I have to do to create
a WinBoard with Spanish menus is then run

./internationalize spanish.txt

where the shell script "internationalize" contains the commands

ed $1<metascript.txt
ed winboard.rc<script.txt
windres -D_WIN32_IE=0x0300 -DWIN32 -DJAWS --use-temp-file --include-dir .. tmp.rc -O coff -o wbres.o

The first command turns the "spanish.txt" into an ed script "script.txt", through the commands in the fixed file "metascript.txt". Te second command runs this ed script
on winboard.rc, performing the text substitutions to translate it, and save the
translation on tmp.rc. The last command compiles this translated resource file,
to generate the nationalized wbres.o. A "make -f makefile.gcc" could follow to
incorporate this in a new winboard.exe.

The file "metascript.txt" contains:

1,$g/""/d
1,$g/^[^"]*$/d
1,$g/&[^"]*"$/s//\\&/
1,$s/===/\/s\/\//
1,$s/$/\/g/
1,$s/^/1,$g\//
$a
w tmp.rc
q
.
w script.txt
q

This first deletes all lines that did contain an empty string as translation
(so that the translator does not have to translate all strings) and lines without quotes (which where contained in the template as headers, formatting blank lines and transation instructions). Then it prefixes a possible & in the translanslated
string with a \ to avoid "ed" interpreting it as a meta-character.
The next three global substitute commands turn the "xxx"==="yyy" format of the
remaining lines into an ed substitute command 1,$g/"xxx"/s//"yyy"/g
Finally commands to save the result on tmp.rc are appended, and then the
whole script is saved in "script.txt".




reply via email to

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