From 83b9dbcbfb15a52034f523b6e8523e6c2d48ec57 Mon Sep 17 00:00:00 2001 From: driAn Date: Wed, 12 Aug 2009 22:06:34 +0000 Subject: [PATCH] localization scripts, samples, localization for cubescript git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4631 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/locale.cfg | 12 +++ config/menus.cfg | 16 ++-- source/locale/AC.pot | 27 +++++-- source/locale/README.txt | 6 ++ source/locale/de/LC_MESSAGES/AC.po | 19 ++++- .../{de_build_mo.bat => de_compile_mo.bat} | 0 source/locale/translate_cpp_files.txt | 74 +++++++++++++++++++ source/locale/translate_cubescript_files.txt | 1 + source/locale/update_pot_template.bat | 7 ++ source/src/main.cpp | 3 +- source/vcpp/cube.vcproj | 4 + 11 files changed, 151 insertions(+), 18 deletions(-) create mode 100644 config/locale.cfg create mode 100644 source/locale/README.txt rename source/locale/{de_build_mo.bat => de_compile_mo.bat} (100%) create mode 100644 source/locale/translate_cpp_files.txt create mode 100644 source/locale/translate_cubescript_files.txt create mode 100644 source/locale/update_pot_template.bat diff --git a/config/locale.cfg b/config/locale.cfg new file mode 100644 index 00000000..3f61c426 --- /dev/null +++ b/config/locale.cfg @@ -0,0 +1,12 @@ +// localization tools + + +// enables localization for a string, so it can be picked up by xgettext +alias gettext [ + result $arg1 +] + +// shortcut, same as the known c++ macro +alias _ [ + result (gettext $arg1) +] \ No newline at end of file diff --git a/config/menus.cfg b/config/menus.cfg index caf8f29a..3b917a49 100755 --- a/config/menus.cfg +++ b/config/menus.cfg @@ -6,14 +6,14 @@ exec config/menus_mappack.cfg newmenu main -menuitem "Multiplayer" "showmenu multiplayer" -menuitem "Singleplayer" "showmenu singleplayer" -menuitem "Settings" "showmenu settings" -menuitem "Demo" [ showmenu "Play demo" ] -menuitem "Editing" "showmenu editing" -menuitem "Help" "showmenu help" -menuitem "About" "showmenu about" -menuitem "Quit" "savequit" +menuitem (_ "Multiplayer") "showmenu multiplayer" +menuitem (_ "Singleplayer") "showmenu singleplayer" +menuitem (_ "Settings") "showmenu settings" +menuitem (_ "Demo") [ showmenu "Play demo" ] +menuitem (_ "Editing") "showmenu editing" +menuitem (_ "Help") "showmenu help" +menuitem (_ "About") "showmenu about" +menuitem (_ "Quit") "savequit" // Start maps. diff --git a/source/locale/AC.pot b/source/locale/AC.pot index b5b665e3..20677540 100644 --- a/source/locale/AC.pot +++ b/source/locale/AC.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-08-12 20:23+0200\n" +"POT-Creation-Date: 2009-08-12 23:55+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,31 +16,44 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: R:\projects\actioncube\_svn\trunk\ac\source\src\main.cpp:614 +#: i18n.cpp:14 msgid "hello world\n" msgstr "" +#: main.cpp:650 +msgid "" +"could not find core textures (hint: run AssaultCube from the parent of the " +"bin directory)" +msgstr "" +#: menus.cfg:9 msgid "Multiplayer" msgstr "" -msgid "Singleplayer" +#: menus.cfg:10 +msgid "Singleplayer" msgstr "" -msgid "Settings" +#: menus.cfg:11 +msgid "Settings" msgstr "" -msgid "Demo" +#: menus.cfg:12 +msgid "Demo" msgstr "" -msgid "Editing" +#: menus.cfg:13 +msgid "Editing" msgstr "" -msgid "Help" +#: menus.cfg:14 +msgid "Help" msgstr "" +#: menus.cfg:15 msgid "About" msgstr "" +#: menus.cfg:16 msgid "Quit" msgstr "" diff --git a/source/locale/README.txt b/source/locale/README.txt new file mode 100644 index 00000000..7edb0d25 --- /dev/null +++ b/source/locale/README.txt @@ -0,0 +1,6 @@ +Info: + +1. Run update_pot_template to extract all localizable strings from the C++ source and from cubescript. The AC.pot template will be updated. +2. Run de_update_po to migrate those changes into the existing german translation file de/lc_messages/AC.po , edit it to translate new strings +3. Finally run de_compile_mo to compile the po file into a binary format, it will be copied to the packages/locale folder +4. Run AC to see if the strings look okay in the UI diff --git a/source/locale/de/LC_MESSAGES/AC.po b/source/locale/de/LC_MESSAGES/AC.po index 5c47f721..5277a3bb 100644 --- a/source/locale/de/LC_MESSAGES/AC.po +++ b/source/locale/de/LC_MESSAGES/AC.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: AC\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-08-12 20:23+0200\n" +"POT-Creation-Date: 2009-08-12 23:55+0200\n" "PO-Revision-Date: 2009-08-12 20:23+0200\n" "Last-Translator: dude \n" "Language-Team: German \n" @@ -14,29 +14,44 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: menus.cfg:15 msgid "About" msgstr "Info" +#: menus.cfg:12 msgid "Demo" msgstr "Demo" +#: menus.cfg:13 msgid "Editing" msgstr "Editieren" +#: menus.cfg:14 msgid "Help" msgstr "Hilfe" +#: menus.cfg:9 msgid "Multiplayer" msgstr "Mehrspieler" +#: menus.cfg:16 msgid "Quit" msgstr "Beenden" +#: menus.cfg:11 msgid "Settings" msgstr "Einstellungen" +#: menus.cfg:10 msgid "Singleplayer" msgstr "Einzelspieler" +#: main.cpp:650 +msgid "" +"could not find core textures (hint: run AssaultCube from the parent of the " +"bin directory)" +msgstr "konnte die Texturen nicht finden (Tipp: Führe AssaultCube vom übergeordneten Verzeichnis von 'bin' aus)" + +#: i18n.cpp:14 msgid "hello world\n" -msgstr "HALLO WELT\n" +msgstr "hallo welt" diff --git a/source/locale/de_build_mo.bat b/source/locale/de_compile_mo.bat similarity index 100% rename from source/locale/de_build_mo.bat rename to source/locale/de_compile_mo.bat diff --git a/source/locale/translate_cpp_files.txt b/source/locale/translate_cpp_files.txt new file mode 100644 index 00000000..83b3a182 --- /dev/null +++ b/source/locale/translate_cpp_files.txt @@ -0,0 +1,74 @@ +audiomanager.cpp +client.cpp +clientgame.cpp +clients2c.cpp +command.cpp +command.h +console.cpp +console.h +cube.h +docs.cpp +editing.cpp +entities.cpp +entity.h +geom.h +hash.h +hudgun.h +i18n.cpp +i18n.h +log.cpp +main.cpp +Makefile +md2.h +md3.h +menus.cpp +model.h +modelcache.h +oggstream.cpp +openal.cpp +packetqueue.cpp +pch.cpp +pch.h +physics.cpp +protocol.cpp +protocol.h +protos.h +rendercubes.cpp +rendergl.cpp +renderhud.cpp +rendermodel.cpp +renderparticles.cpp +rendertext.cpp +rndmap.cpp +scale.h +scoreboard.cpp +server.cpp +server.h +serveractions.h +serverbrowser.cpp +servercontroller.h +serverevents.h +serverfiles.h +serverms.cpp +shadow.cpp +sound.cpp +sound.h +soundlocation.cpp +soundscheduler.cpp +texture.cpp +tools.cpp +tools.h +tristrip.h +vertmodel.h +vote.h +water.cpp +weapon.cpp +weapon.h +winserviceinstaller.h +wizard.cpp +world.cpp +world.h +worldio.cpp +worldlight.cpp +worldocull.cpp +worldrender.cpp \ No newline at end of file diff --git a/source/locale/translate_cubescript_files.txt b/source/locale/translate_cubescript_files.txt new file mode 100644 index 00000000..0621ec52 --- /dev/null +++ b/source/locale/translate_cubescript_files.txt @@ -0,0 +1 @@ +menus.cfg \ No newline at end of file diff --git a/source/locale/update_pot_template.bat b/source/locale/update_pot_template.bat new file mode 100644 index 00000000..2735e1e3 --- /dev/null +++ b/source/locale/update_pot_template.bat @@ -0,0 +1,7 @@ +REM search C++ source files +xgettext -d AC -o AC.pot --sort-by-file -k_ -C -D ..\src -f translate_cpp_files.txt + +REM add script translations to it +xgettext -d AC -o AC.pot --sort-by-file -k_ -j -L Lisp -D ..\..\config -f translate_cubescript_files.txt + +pause diff --git a/source/src/main.cpp b/source/src/main.cpp index 0578a313..0ed536e7 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -647,7 +647,7 @@ int main(int argc, char **argv) gl_init(scr_w, scr_h, usedcolorbits, useddepthbits, usedfsaa); notexture = noworldtexture = textureload("packages/misc/notexture.jpg"); - if(!notexture) fatal("could not find core textures (hint: run AssaultCube from the parent of the bin directory)"); + if(!notexture) fatal(_("could not find core textures (hint: run AssaultCube from the parent of the bin directory)")); initlog("console"); persistidents = false; @@ -677,6 +677,7 @@ int main(int argc, char **argv) applymenu = addmenu("apply", "apply changes now?", true, refreshapplymenu); exec("config/scontext.cfg"); + exec("config/locale.cfg"); exec("config/keymap.cfg"); exec("config/menus.cfg"); exec("config/scripts.cfg"); diff --git a/source/vcpp/cube.vcproj b/source/vcpp/cube.vcproj index 0d6241bd..c0b42c48 100644 --- a/source/vcpp/cube.vcproj +++ b/source/vcpp/cube.vcproj @@ -1990,6 +1990,10 @@ RelativePath="..\..\config\keymap.cfg" > + +