forked from basket-notepads/basket
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added extract-messages.sh Made po/CMakeLists.txt work ran extract-messages.sh to update po/basket.pot and every .po file Added the po subdirectory to the root CMakeLists.txt
- Loading branch information
Showing
19 changed files
with
24,310 additions
and
17,859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh | ||
|
||
# Copied from http://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems#Extracting_and_merging_messages | ||
|
||
BASEDIR="." # root of translatable sources | ||
PROJECT="basket" # project name | ||
BUGADDR="" # MSGID-Bugs | ||
WDIR=`pwd` # working dir | ||
|
||
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 | ||
# additional string for KAboutData | ||
echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/rc.cpp | ||
echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/rc.cpp | ||
cd ${WDIR} | ||
echo "Done preparing rc files" | ||
|
||
|
||
echo "Extracting messages" | ||
cd ${BASEDIR} | ||
# see above on sorting | ||
find . -name '*.cpp' -o -name '*.h' -o -name '*.c' | sort > ${WDIR}/infiles.list | ||
echo "rc.cpp" >> ${WDIR}/infiles.list | ||
cd ${WDIR} | ||
xgettext --from-code=UTF-8 -C -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 ${BASEDIR}/po/${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 ${BASEDIR}/po/${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 | ||
echo "Done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
# Copied from http://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems#Compiling_and_installing_message_catalogs | ||
|
||
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) | ||
|
||
#original Makefile.am contents follow: | ||
SET(catalogname basket) | ||
|
||
#POFILES = AUTO | ||
#noinst_HEADERS = basket.pot fr.po nl.po de.po nn.po zh_TW.po zh_CN.po pl_PL.po es.po pt.po | ||
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) |
Oops, something went wrong.