Add translation output to Cmake
This commit is contained in:
parent
b2ffc709bb
commit
7753e42078
@ -39,6 +39,7 @@ ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
add_subdirectory(resources)
|
||||
add_subdirectory(doxygen)
|
||||
add_subdirectory(translations)
|
||||
add_subdirectory(version)
|
||||
|
||||
include_directories(${GLIB_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
4
translations/CMakeLists.txt
Normal file
4
translations/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_custom_target(translations
|
||||
COMMAND ./generate-mo.sh "${PROJECT_BINARY_DIR}/translations"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Generating translation locales")
|
23
translations/generate-mo.sh
Executable file
23
translations/generate-mo.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
|
||||
cd "$DIR"
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Must supply an output name"
|
||||
exit -2
|
||||
fi
|
||||
|
||||
for langdir in `find ./pot/po -mindepth 1 -maxdepth 1 -type d`; do
|
||||
lang=`basename "$langdir"`
|
||||
dest="$1/locale/$lang/LC_MESSAGES"
|
||||
mkdir -p "$dest"
|
||||
pofiles=`find "$langdir" -name "*.po"`
|
||||
msgfmt --output-file="$dest/gds-render.mo" "$pofiles"
|
||||
done
|
Loading…
Reference in New Issue
Block a user