Skip to content

Commit

Permalink
Prepare cmake to maintain the .pot and .po files
Browse files Browse the repository at this point in the history
In the future .po files will be processed directly using Weblate
rather than fetching them from the translators SVN.
  • Loading branch information
mlandres committed May 3, 2016
1 parent c001d26 commit 33d11ce
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 184 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.po merge=binary
*.pot merge=binary
145 changes: 0 additions & 145 deletions cmake/modules/FindGettext.cmake

This file was deleted.

7 changes: 0 additions & 7 deletions libzypp.spec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@ export CXX=g++-4.6
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
unset EXTRA_CMAKE_OPTIONS
# We are moving towards a uniform translation set for SLE and openSUSE.
# While separate SLE translations are still present, overlay them.
unset TRANSLATION_SET
if [ -f ../po/sle-zypp-po.tar.bz2 ]; then
export TRANSLATION_SET=sle-zypp
fi
# No libproxy on SLE11
%if 0%{?suse_version} == 1110
export EXTRA_CMAKE_OPTIONS="-DDISABLE_LIBPROXY=ON"
Expand All @@ -212,7 +206,6 @@ cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DLIB=%{_lib} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=1 \
-DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
${EXTRA_CMAKE_OPTIONS} \
..
make %{?_smp_mflags} VERBOSE=1
Expand Down
43 changes: 27 additions & 16 deletions po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#
# Creating the .pot file to be translated.
#
ADD_CUSTOM_TARGET( zypp.pot
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/createPot ${LIBZYPP_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/zypp.pot
)
SET_DIRECTORY_PROPERTIES( PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES zypp.pot
)
# Translation set name
SET( POT_NAME "zypp" )

SET( POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${POT_NAME}.pot )

FILE( GLOB PO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po" )

#
# Provides the 'translations' target that creates the .gmo files
# out of the pofiles provided by zypp-po.tar.bz2.
# Use USE_TRANSLATION_SET to use an alternate set provided by
# ${USE_TRANSLATION_SET}-po.tar.bz2
#
GETTEXT_CREATE_TARBALL_TRANSLATIONS( "zypp" )
# Provides the 'translations' target that
# creates the .gmo files out of the .po files
GETTEXT_CREATE_TRANSLATIONS( ${POT_FILE} "ALL" ${PO_FILES} )

# Creating the .pot file and preparing the .po files
# POT_FILE_DEPENDS was set in ../src
SET( XGETTEXT_CMD "xgettext" )
SET( XGETTEXT_OPTIONS -L C++ --boost --no-wrap --add-comments --add-location --foreign-user )
SET( XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS} --keyword=_ --keyword=_:1,2 --keyword=__ --keyword=N_ --keyword=PL_:1,2 )
SET( XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS} --copyright-holder=\"SuSE Linux GmbH, Nuernberg\" )
SET( XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS} --package-name=${POT_NAME} --default-domain=${POT_NAME} )

ADD_CUSTOM_COMMAND( OUTPUT ${POT_FILE}
COMMAND ${XGETTEXT_CMD} ${XGETTEXT_OPTIONS} --output=${POT_FILE} ${POT_FILE_DEPENDS}
WORKING_DIRECTORY ${LIBZYPP_SOURCE_DIR}
COMMENT "Extract translatable messages to ${POT_FILE}"
)

ADD_CUSTOM_TARGET( potfile
COMMAND rm -f ${POT_FILE}
COMMAND make translations
)
13 changes: 0 additions & 13 deletions po/createPot

This file was deleted.

Binary file removed po/sle-zypp-po.tar.bz2
Binary file not shown.
Binary file removed po/zypp-po.tar.bz2
Binary file not shown.
7 changes: 4 additions & 3 deletions zypp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
####################################################################
# SOURCES #
####################################################################
# Collect all files that may contain translatable texts
FILE( GLOB_RECURSE POT_FILE_DEPENDS RELATIVE ${LIBZYPP_SOURCE_DIR} "*.h" "*.cc" )
SET( POT_FILE_DEPENDS ${POT_FILE_DEPENDS} PARENT_SCOPE )


ADD_DEFINITIONS(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale" -DTEXTDOMAIN="zypp" -DZYPP_DLL )

Expand Down

0 comments on commit 33d11ce

Please sign in to comment.