summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2016-09-26 21:46:28 +0200
committerMilan Crha <mcrha@redhat.com>2016-09-26 21:46:28 +0200
commit925f702cba0021c48759a431a5c7820b21a25839 (patch)
treec99f0a1c8d3cf3d1c94d0695c5f14c28b17250cd
parent70087e9bfc6e19e10c277b2c668aec1fa9747627 (diff)
downloadevolution-data-server-925f702cba0021c48759a431a5c7820b21a25839.tar.gz
po/ directory, aka translations; still using intltool
-rw-r--r--CMakeLists.txt5
-rw-r--r--cmake/modules/FindIntltool.cmake131
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--modules/ubuntu-online-accounts/CMakeLists.txt41
-rw-r--r--po/CMakeLists.txt2
-rw-r--r--po/LINGUAS89
6 files changed, 162 insertions, 108 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4cf13359e..910bd9a63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,9 @@ set(BASE_VERSION 3.24)
# library names for backward compatibility.
set(API_VERSION 1.2)
+# Required for FindIntltool module
set(GETTEXT_PACKAGE ${PROJECT_NAME}-${BASE_VERSION})
+set(GETTEXT_PO_DIR ${CMAKE_SOURCE_DIR}/po)
# ******************************
# D-Bus versioning
@@ -211,6 +213,7 @@ include(PkgConfigEx)
include(SetupBuildFlags)
include(UninstallTarget)
+include(FindIntltool)
include(FindKRB5)
include(FindLDAP)
include(FindPhonenumber)
@@ -870,7 +873,7 @@ add_subdirectory(libebackend)
add_subdirectory(libedataserver)
add_subdirectory(modules)
add_subdirectory(private)
-#add_subdirectory(po)
+add_subdirectory(po)
#add_subdirectory(services)
#add_subdirectory(tests)
add_subdirectory(tools)
diff --git a/cmake/modules/FindIntltool.cmake b/cmake/modules/FindIntltool.cmake
new file mode 100644
index 000000000..85530196a
--- /dev/null
+++ b/cmake/modules/FindIntltool.cmake
@@ -0,0 +1,131 @@
+# FindIntltool.cmake
+#
+# Searches for intltool and gettext. It aborts, if anything cannot be found.
+# Requires GETTEXT_PO_DIR to be set to full path of the po/ directory.
+#
+# Output is:
+# INTLTOOL_UPDATE - an intltool-update executable path, as found
+# INTLTOOL_EXTRACT - an intltool-extract executable path, as found
+# INTLTOOL_MERGE - an intltool-merge executable path, as found
+#
+# and anything from the FindGettext module.
+#
+# The below provided macros require GETTEXT_PACKAGE to be set.
+#
+# intltool_add_pot_file_target()
+# Creates a new target pot-file, which generates ${GETTEXT_PACKAGE}.pot file into
+# the CMAKE_CURERNT_BINARY_DIR. This target is not part of ALL.
+# This can be called only inside GETTEXT_PO_DIR.
+#
+# intltool_process_po_files(_po_files_var)
+# Processes all files in the list variable _po_files_var, which are
+# located in CMAKE_CURRENT_SOURCE_DIR and generates .gmo files for them
+# in CMAKE_CURRENT_BINARY_DIR. These are added into a new target gmo-files.
+# It also installs them into proper location under LOCALE_INSTALL_DIR.
+# This can be called only inside GETTEXT_PO_DIR.
+#
+# intltool_merge(_in_filename _out_filename ...args)
+# Adds rule to call intltool-merge. The args are optional arguments.
+# This can be called in any folder, only the GETTEXT_PO_DIR should
+# be properly set, otherwise the call will fail.
+
+include(FindGettext)
+
+if(NOT GETTEXT_FOUND)
+ message(FATAL_ERROR "gettext not found, please install at least 0.18.3 version")
+endif(NOT GETTEXT_FOUND)
+
+if(NOT GETTEXT_FOUND)
+ message(FATAL_ERROR "gettext not found, please install at least 0.18.3 version")
+endif(NOT GETTEXT_FOUND)
+
+if(GETTEXT_VERSION_STRING VERSION_LESS "0.18.3")
+ message(FATAL_ERROR "gettext version 0.18.3+ required, but version '${GETTEXT_VERSION_STRING}' found instead. Please update your gettext")
+endif(GETTEXT_VERSION_STRING VERSION_LESS "0.18.3")
+
+find_program(XGETTEXT xgettext)
+if(NOT XGETTEXT)
+ message(FATAL_ERROR "xgettext executable not found. Please install or update your gettext to at least 0.18.3 version")
+endif(NOT XGETTEXT)
+
+find_program(INTLTOOL_UPDATE intltool-update)
+if(NOT INTLTOOL_UPDATE)
+ message(FATAL_ERROR "intltool-update not found. Please install it (usually part of an 'intltool' package)")
+endif(NOT INTLTOOL_UPDATE)
+
+find_program(INTLTOOL_EXTRACT intltool-extract)
+if(NOT INTLTOOL_EXTRACT)
+ message(FATAL_ERROR "intltool-extract not found. Please install it (usually part of an 'intltool' package)")
+endif(NOT INTLTOOL_EXTRACT)
+
+find_program(INTLTOOL_MERGE intltool-merge)
+if(NOT INTLTOOL_MERGE)
+ message(FATAL_ERROR "intltool-merge not found. Please install it (usually part of an 'intltool' package)")
+endif(NOT INTLTOOL_MERGE)
+
+macro(intltool_add_pot_file_target)
+ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+ message(FATAL_ERROR "intltool_add_pot_file_target() can be called only inside GETTEXT_PO_DIR ('${GETTEXT_PO_DIR}'), but it is called inside '${CMAKE_CURRENT_SOURCE_DIR}' instead")
+ endif(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${GETTEXT_PACKAGE}.pot
+ COMMAND cmake -E env INTLTOOL_EXTRACT="${INTLTOOL_EXTRACT}" XGETTEXT="${XGETTEXT}" srcdir=${CMAKE_CURRENT_SOURCE_DIR} ${INTLTOOL_UPDATE} --gettext-package ${GETTEXT_PACKAGE} --pot
+ )
+
+ add_custom_target(pot-file
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GETTEXT_PACKAGE}.pot
+ )
+endmacro(intltool_add_pot_file_target)
+
+macro(intltool_process_po_files)
+ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+ message(FATAL_ERROR "intltool_process_po_files() can be called only inside GETTEXT_PO_DIR ('${GETTEXT_PO_DIR}'), but it is called inside '${CMAKE_CURRENT_SOURCE_DIR}' instead")
+ endif(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+
+ file(GLOB po_files ${GETTEXT_PO_DIR}/*.po)
+
+ set(LINGUAS)
+ set(LINGUAS_GMO)
+
+ foreach(file IN LISTS po_files)
+ get_filename_component(lang ${file} NAME_WE)
+ list(APPEND LINGUAS ${lang})
+ list(APPEND LINGUAS_GMO ${lang}.gmo)
+
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po
+ DEPENDS ${lang}.po
+ )
+
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo
+ DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_MESSAGES/
+ RENAME ${GETTEXT_PACKAGE}.mo
+ )
+ if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo.m)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo.m
+ DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_MESSAGES/
+ RENAME ${GETTEXT_PACKAGE}.mo.m
+ )
+ endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo.m)
+ endforeach(file)
+
+ add_custom_target(gmo-files ALL
+ DEPENDS ${LINGUAS_GMO}
+ )
+endmacro(intltool_process_po_files)
+
+macro(intltool_merge _in_filename _out_filename)
+ get_filename_component(_path ${_in_filename} DIRECTORY)
+ if(_path STREQUAL "")
+ set(_in_filename "${CMAKE_CURRENT_SOURCE_DIR}/${_in_filename}")
+ endif(_path STREQUAL "")
+
+ get_filename_component(_path ${_out_filename} DIRECTORY)
+ if(_path STREQUAL "")
+ set(_out_filename "${CMAKE_CURRENT_BINARY_DIR}/${_out_filename}")
+ endif(_path STREQUAL "")
+
+ add_custom_command(OUTPUT ${_out_filename}
+ COMMAND ${INTLTOOL_MERGE} ${ARGN} "${GETTEXT_PO_DIR}" "${_in_filename}" "${_out_filename}"
+ )
+endmacro(intltool_merge)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 6e75abc8f..201678f07 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1 +1 @@
-add_subdirectory(cursor) \ No newline at end of file
+add_subdirectory(cursor)
diff --git a/modules/ubuntu-online-accounts/CMakeLists.txt b/modules/ubuntu-online-accounts/CMakeLists.txt
index 629842978..d4d0ca177 100644
--- a/modules/ubuntu-online-accounts/CMakeLists.txt
+++ b/modules/ubuntu-online-accounts/CMakeLists.txt
@@ -56,13 +56,17 @@ add_credentials_module(module-credentials-uoa
# Data files
# ******************************
-set(servicetype_files
+set(servicetype_files)
+set(servicetype_files_gen)
+list(APPEND servicetype_files
mail.service-type
calendar.service-type
contacts.service-type
)
-set(service_files
+set(service_files)
+set(service_files_gen)
+list(APPEND service_files
google-gmail.service
google-calendar.service
google-contacts.service
@@ -71,33 +75,36 @@ set(service_files
yahoo-calendar.service
)
-# TODO | FIXME
-#%.application: %.application.in
-# $(AM_V_GEN) $(INTLTOOL_MERGE) --no-translations -x -u $< $@
-#
-#%.service-type: %.service-type.in
-# $(AM_V_GEN) $(INTLTOOL_MERGE) --no-translations -x -u $< $@
-#
-#%.service: %.service.in
-# $(AM_V_GEN) $(INTLTOOL_MERGE) --no-translations -x -u $< $@
+intltool_merge(evolution-data-server.application.in evolution-data-server.application --no-translations --xml-style --utf8)
+intltool_merge(evolution-data-server-uoa.desktop.in evolution-data-server-uoa.desktop --desktop-style --utf8)
+
+foreach(_file IN LISTS servicetype_files)
+ intltool_merge(${_file}.in ${_file} --no-translations -x -u)
+ list(APPEND servicetype_files_gen ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+endforeach(_file)
+
+foreach(_file IN LISTS service_files)
+ intltool_merge(${_file}.in ${_file} --no-translations -x -u)
+ list(APPEND service_files_gen ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+endforeach(_file)
desktopdir = ${SHARE_INSTALL_DIR}/applications
pkg_check_variable(applicationdir libaccounts-glib applicationfilesdir)
pkg_check_variable(servicetypedir libaccounts-glib servicetypefilesdir)
pkg_check_variable(servicedir libaccounts-glib servicefilesdir)
-install(FILES evolution-data-server-uoa.desktop
- DESTINATION ${desktopdir}
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server.application
+ DESTINATION ${applicationdir}
)
-install(FILES evolution-data-server.application
- DESTINATION ${applicationdir}
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-uoa.desktop
+ DESTINATION ${desktopdir}
)
-install(FILES ${servicetype_files}
+install(FILES ${servicetype_files_gen}
DESTINATION ${servicetypedir}
)
-install(FILES ${service_files}
+install(FILES ${service_files_gen}
DESTINATION ${servicedir}
)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 000000000..8c09ff5ff
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,2 @@
+intltool_process_po_files()
+intltool_add_pot_file_target()
diff --git a/po/LINGUAS b/po/LINGUAS
deleted file mode 100644
index 1820a5381..000000000
--- a/po/LINGUAS
+++ /dev/null
@@ -1,89 +0,0 @@
-# please keep this list sorted alphabetically
-#
-am
-ar
-as
-ast
-az
-be
-bg
-bn
-bn_IN
-bs
-ca
-ca@valencia
-cs
-cy
-da
-de
-dz
-el
-en_AU
-en_CA
-en_GB
-en@shaw
-eo
-es
-et
-eu
-fa
-fi
-fr
-ga
-gl
-gu
-he
-hi
-hr
-hu
-id
-is
-it
-ja
-ka
-kk
-km
-kn
-ko
-ku
-lt
-lv
-mai
-mk
-ml
-mn
-mr
-ms
-nb
-ne
-nl
-nn
-oc
-or
-pa
-pl
-pt
-pt_BR
-ro
-ru
-rw
-si
-sk
-sl
-sq
-sr
-sr@latin
-sv
-ta
-te
-tg
-th
-tr
-ug
-uk
-vi
-wa
-xh
-zh_CN
-zh_HK
-zh_TW