Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Setup a very simple i18n system. Add italian translation.

The i18n.sh script takes care of extracting messages and merging.
xgettex runs in python mode, since ruby is not supported. This does not
seem to create any problems.
  • Loading branch information...
commit e6b44877fb12eff121c9824b67f1a20f379fa782 1 parent 04f7487
@pcapriotti authored
View
2  CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.6)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
add_subdirectory(lib)
-
+add_subdirectory(translations)
configure_file(main.rb main.rb)
View
41 i18n.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+PROJECT="kaya" # project name
+BUGADDR="http://github.com/pcapriotti/kaya/issues"
+WDIR=`pwd` # working dir
+BASEDIR=${WDIR} # root of translatable sources
+
+echo "Preparing rc files"
+cd ${BASEDIR}
+# we use simple sorting to make sure the lines do not jump around too much from system to system
+find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | sort > ${WDIR}/rcfiles.list
+xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp
+cd ${WDIR}
+echo "Done preparing rc files"
+
+echo "Extracting messages"
+cd ${BASEDIR}
+# see above on sorting
+find . -name '*.rb' | sort > ${WDIR}/infiles.list
+echo "rc.cpp" >> ${WDIR}/infiles.list
+cd ${WDIR}
+xgettext --from-code=UTF-8 -L python -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \
+-kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
+--msgid-bugs-address="${BUGADDR}" \
+--files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "error while calling xgettext. aborting."; exit 1; }
+echo "Done extracting messages"
+
+echo "Merging translations"
+catalogs=`find . -name '*.po'`
+for cat in $catalogs; do
+echo $cat
+msgmerge -o $cat.new $cat ${PROJECT}.pot
+mv $cat.new $cat
+done
+echo "Done merging translations"
+
+
+echo "Cleaning up"
+cd ${WDIR}
+rm rcfiles.list
+rm infiles.list
+rm rc.cpp
View
188 kaya.pot
@@ -0,0 +1,188 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: http://github.com/pcapriotti/kaya/issues\n"
+"POT-Creation-Date: 2010-02-13 23:23+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/engine_prefs.rb:23
+msgid "&Name:"
+msgstr ""
+
+#: lib/engine_prefs.rb:31
+msgid "&Type:"
+msgstr ""
+
+#: lib/engine_prefs.rb:47 lib/newgame.rb:27
+msgid "&Game:"
+msgstr ""
+
+#: lib/engine_prefs.rb:56
+msgid "&Path:"
+msgstr ""
+
+#: lib/engine_prefs.rb:64
+msgid "&Arguments: "
+msgstr ""
+
+#: lib/engine_prefs.rb:72
+msgid "&Work directory:"
+msgstr ""
+
+#: lib/engine_prefs.rb:116
+msgid "Configure Engines"
+msgstr ""
+
+#: lib/engine_prefs.rb:136
+msgctxt "engine"
+msgid "&New..."
+msgstr ""
+
+#: lib/engine_prefs.rb:139
+msgctxt "engine"
+msgid "&Edit..."
+msgstr ""
+
+#: lib/engine_prefs.rb:142
+msgctxt "engine"
+msgid "&Delete"
+msgstr ""
+
+#: lib/engine_prefs.rb:170
+msgid "New Engine"
+msgstr ""
+
+#: lib/engine_prefs.rb:188
+msgid "Edit Engine"
+msgstr ""
+
+#: lib/kaya.rb:25
+msgid "Kaya"
+msgstr ""
+
+#: lib/kaya.rb:26
+msgid "KDE Board Game Suite"
+msgstr ""
+
+#: lib/kaya.rb:27
+msgid "(C) 2009 Paolo Capriotti"
+msgstr ""
+
+#: lib/kaya.rb:28
+msgid "Paolo Capriotti"
+msgstr ""
+
+#: lib/kaya.rb:29
+msgid "Jani Huhtanen"
+msgstr ""
+
+#: lib/kaya.rb:29
+msgid "Gaussian blur code"
+msgstr ""
+
+#: lib/kaya.rb:30
+msgid "Yann Dirson"
+msgstr ""
+
+#: lib/kaya.rb:30
+msgid "Minishogi"
+msgstr ""
+
+#: lib/kaya.rb:32
+msgid "Initial game"
+msgstr ""
+
+#: lib/mainwindow.rb:69
+msgid "B&ack"
+msgstr ""
+
+#: lib/mainwindow.rb:73
+msgid "&Forward"
+msgstr ""
+
+#: lib/mainwindow.rb:78
+msgid "F&lip"
+msgstr ""
+
+#: lib/mainwindow.rb:85
+msgid "Configure &Engines..."
+msgstr ""
+
+#: lib/mainwindow.rb:92
+msgid "Configure &Themes..."
+msgstr ""
+
+#: lib/mainwindow.rb:129
+msgid "History"
+msgstr ""
+
+#: lib/mainwindow.rb:146
+msgid "Console"
+msgstr ""
+
+#: lib/mainwindow.rb:229
+msgid "Open game"
+msgstr ""
+
+#: lib/mainwindow.rb:293
+msgid "Save game"
+msgstr ""
+
+#: lib/newgame.rb:17
+msgid "New game"
+msgstr ""
+
+#: lib/newgame.rb:23
+msgid "Open in new &tab"
+msgstr ""
+
+#: lib/newgame.rb:90
+msgid "Human"
+msgstr ""
+
+#: lib/plugins/ics/ics.rb:28
+msgid "&Connect to ICS"
+msgstr ""
+
+#: lib/plugins/ics/ics.rb:33
+msgid "&Disconnect from ICS"
+msgstr ""
+
+#: lib/plugins/ics/ics.rb:46
+msgid "Configure &ICS..."
+msgstr ""
+
+#: lib/theme_prefs.rb:24
+msgid "&Games"
+msgstr ""
+
+#: lib/theme_prefs.rb:25
+msgid "&Categories"
+msgstr ""
+
+#: lib/theme_prefs.rb:42
+msgid "Configure themes"
+msgstr ""
+
+#: rc.cpp:3
+msgid "&Game"
+msgstr ""
+
+#: rc.cpp:6
+msgid "&View"
+msgstr ""
+
+#: rc.cpp:9
+msgid "Game Toolbar"
+msgstr ""
View
33 translations/CMakeLists.txt
@@ -0,0 +1,33 @@
+FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
+
+IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
+ MESSAGE(
+"------
+ NOTE: msgfmt not found. Translations will *not* be installed
+------")
+ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
+
+ SET(catalogname kaya)
+
+ ADD_CUSTOM_TARGET(translations ALL)
+
+ FILE(GLOB PO_FILES *.po)
+
+ FOREACH(_poFile ${PO_FILES})
+ GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
+ STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
+ STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
+
+ IF( _langCode )
+ GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ ADD_CUSTOM_COMMAND(TARGET translations
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
+ DEPENDS ${_poFile})
+ INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
+ ENDIF( _langCode )
+
+ ENDFOREACH(_poFile ${PO_FILES})
+
+ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)
View
187 translations/it.po
@@ -0,0 +1,187 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.3\n"
+"Report-Msgid-Bugs-To: http://github.com/pcapriotti/kaya/issues\n"
+"POT-Creation-Date: 2010-02-13 23:23+0000\n"
+"PO-Revision-Date: 2010-02-13 23:10+0000\n"
+"Last-Translator: Paolo Capriotti <p.capriotti@gmail.com>\n"
+"Language-Team: Italian\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/engine_prefs.rb:23
+msgid "&Name:"
+msgstr "&Nome:"
+
+#: lib/engine_prefs.rb:31
+msgid "&Type:"
+msgstr "&Tipo:"
+
+#: lib/engine_prefs.rb:47 lib/newgame.rb:27
+msgid "&Game:"
+msgstr "&Gioco:"
+
+#: lib/engine_prefs.rb:56
+msgid "&Path:"
+msgstr "&Percorso:"
+
+#: lib/engine_prefs.rb:64
+msgid "&Arguments: "
+msgstr "&Argomenti:"
+
+#: lib/engine_prefs.rb:72
+msgid "&Work directory:"
+msgstr "&Directory di lavoro:"
+
+#: lib/engine_prefs.rb:116
+msgid "Configure Engines"
+msgstr "Configura engine"
+
+#: lib/engine_prefs.rb:136
+msgctxt "engine"
+msgid "&New..."
+msgstr "&Nuova..."
+
+#: lib/engine_prefs.rb:139
+msgctxt "engine"
+msgid "&Edit..."
+msgstr "&Modifica..."
+
+#: lib/engine_prefs.rb:142
+msgctxt "engine"
+msgid "&Delete"
+msgstr "&Elimina"
+
+#: lib/engine_prefs.rb:170
+msgid "New Engine"
+msgstr "Nuova engine"
+
+#: lib/engine_prefs.rb:188
+msgid "Edit Engine"
+msgstr "Modifica engine"
+
+#: lib/kaya.rb:25
+msgid "Kaya"
+msgstr "Kaya"
+
+#: lib/kaya.rb:26
+msgid "KDE Board Game Suite"
+msgstr "Collezione di giochi da tavolo per KDE"
+
+#: lib/kaya.rb:27
+msgid "(C) 2009 Paolo Capriotti"
+msgstr "(C) 2009 Paolo Capriotti"
+
+#: lib/kaya.rb:28
+msgid "Paolo Capriotti"
+msgstr "Paolo Capriotti"
+
+#: lib/kaya.rb:29
+msgid "Jani Huhtanen"
+msgstr "Jani Huhtanen"
+
+#: lib/kaya.rb:29
+msgid "Gaussian blur code"
+msgstr "Codice per il blur gaussiano"
+
+#: lib/kaya.rb:30
+msgid "Yann Dirson"
+msgstr "Yann Dirson"
+
+#: lib/kaya.rb:30
+msgid "Minishogi"
+msgstr "Minishogi"
+
+#: lib/kaya.rb:32
+msgid "Initial game"
+msgstr "Gioco iniziale"
+
+#: lib/mainwindow.rb:69
+msgid "B&ack"
+msgstr "&Indietro"
+
+#: lib/mainwindow.rb:73
+msgid "&Forward"
+msgstr "&Avanti"
+
+#: lib/mainwindow.rb:78
+msgid "F&lip"
+msgstr "&Rovescia"
+
+#: lib/mainwindow.rb:85
+msgid "Configure &Engines..."
+msgstr "Configura &engine..."
+
+#: lib/mainwindow.rb:92
+msgid "Configure &Themes..."
+msgstr "Configura &temi..."
+
+#: lib/mainwindow.rb:129
+msgid "History"
+msgstr "Storia"
+
+#: lib/mainwindow.rb:146
+msgid "Console"
+msgstr "Console"
+
+#: lib/mainwindow.rb:229
+msgid "Open game"
+msgstr "Apri partita"
+
+#: lib/mainwindow.rb:293
+msgid "Save game"
+msgstr "Salva partita"
+
+#: lib/newgame.rb:17
+msgid "New game"
+msgstr "Nuova partita"
+
+#: lib/newgame.rb:23
+msgid "Open in new &tab"
+msgstr "Apri in una nuova &scheda"
+
+#: lib/newgame.rb:90
+msgid "Human"
+msgstr "Umano"
+
+#: lib/plugins/ics/ics.rb:28
+msgid "&Connect to ICS"
+msgstr "&Connetti a ICS"
+
+#: lib/plugins/ics/ics.rb:33
+msgid "&Disconnect from ICS"
+msgstr "&Disconnetti da ICS"
+
+#: lib/plugins/ics/ics.rb:46
+msgid "Configure &ICS..."
+msgstr "Configura &ICS..."
+
+#: lib/theme_prefs.rb:24
+msgid "&Games"
+msgstr "&Giochi"
+
+#: lib/theme_prefs.rb:25
+msgid "&Categories"
+msgstr "&Categorie"
+
+#: lib/theme_prefs.rb:42
+msgid "Configure themes"
+msgstr "Configura temi"
+
+#: rc.cpp:3
+msgid "&Game"
+msgstr "&Gioco"
+
+#: rc.cpp:6
+msgid "&View"
+msgstr "&Vista"
+
+#: rc.cpp:9
+msgid "Game Toolbar"
+msgstr "Toolbar di gioco"
Please sign in to comment.
Something went wrong with that request. Please try again.