aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--INSTALL1
-rw-r--r--cmake/Gettext.cmake179
-rw-r--r--cmake/Translations.cmake41
-rw-r--r--po/CMakeLists.txt3
-rw-r--r--po/LINGUAS99
-rw-r--r--po/POTFILES.in14
7 files changed, 46 insertions, 292 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index feb332c..5f04214 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}/src)
add_subdirectory (src)
add_subdirectory (data)
+add_subdirectory (po)
if (${enable_tests})
set (GTEST_SOURCE_DIR /usr/src/gtest/src)
diff --git a/INSTALL b/INSTALL
index ef5d8e5..1ca082b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -18,6 +18,7 @@ Build dependencies
------------------
List of packages required to build and test the code:
+- gettext (gettext 0.18.1.1-10ubuntu3 or later)
- glib (libglib2.0, 2.35.4 or later)
- cmake (cmake, 2.8.9 or later)
- gcovr (gcovr, 2.4 or later)
diff --git a/cmake/Gettext.cmake b/cmake/Gettext.cmake
deleted file mode 100644
index 9be4742..0000000
--- a/cmake/Gettext.cmake
+++ /dev/null
@@ -1,179 +0,0 @@
-# Gettext support: Create/Update pot file and
-#
-# To use: INCLUDE(Gettext)
-#
-# Most of the gettext support code is from FindGettext.cmake of cmake,
-# but it is included here because:
-#
-# 1. Some system like RHEL5 does not have FindGettext.cmake
-# 2. Bug of GETTEXT_CREATE_TRANSLATIONS make it unable to be include in 'All'
-# 3. It does not support xgettext
-#
-#===================================================================
-# Constants:
-# XGETTEXT_OPTIONS_DEFAULT: Default xgettext option:
-#===================================================================
-# Variables:
-# XGETTEXT_OPTIONS: Options pass to xgettext
-# Default: XGETTEXT_OPTIONS_DEFAULT
-# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
-# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
-# GETTEXT_FOUND: True if gettext has been found.
-# XGETTEXT_EXECUTABLE: the full path to the xgettext.
-# XGETTEXT_FOUND: True if xgettext has been found.
-#
-#===================================================================
-# Macros:
-# GETTEXT_CREATE_POT(potFile
-# [OPTION xgettext_options]
-# SRC list_of_source_file_that_contains_msgid
-# )
-#
-# Generate .pot file.
-# OPTION xgettext_options: Override XGETTEXT_OPTIONS
-#
-# * Produced targets: pot_file
-#
-#-------------------------------------------------------------------
-# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] locale1 ... localeN
-# [COMMENT comment] )
-#
-# This will create a target "translations" which will convert the
-# given input po files into the binary output mo file. If the
-# ALL option is used, the translations will also be created when
-# building the default target.
-#
-# * Produced targets: translations
-#-------------------------------------------------------------------
-
-FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
-FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
-FIND_PROGRAM(GETTEXT_MSGCAT_EXECUTABLE msgcat)
-FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
-
-SET(XGETTEXT_OPTIONS_DEFAULT
- --language=C --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 -s
- --escape --add-comments="/" --package-name=${PROJECT_NAME} --package-version=${VERSION})
-
-IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE AND GETTEXT_MSGCAT_EXECUTABLE)
- SET(GETTEXT_FOUND TRUE)
-ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
- SET(GETTEXT_FOUND FALSE)
- IF (GetText_REQUIRED)
- MESSAGE(FATAL_ERROR "GetText not found")
- ENDIF (GetText_REQUIRED)
-ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE AND GETTEXT_MSGCAT_EXECUTABLE)
-
-IF(XGETTEXT_EXECUTABLE)
- SET(XGETTEXT_FOUND TRUE)
-ELSE(XGETTEXT_EXECUTABLE)
- MESSAGE(STATUS "xgettext not found.")
- SET(XGETTTEXT_FOUND FALSE)
-ENDIF(XGETTEXT_EXECUTABLE)
-
-IF(NOT DEFINED XGETTEXT_OPTIONS)
- SET(XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS_DEFAULT})
-ENDIF(NOT DEFINED XGETTEXT_OPTIONS)
-
-IF(XGETTEXT_FOUND)
- MACRO(GETTEXT_CREATE_POT _potFile _pot_options )
- SET(_xgettext_options_list)
- SET(_src_list)
- SET(_src_list_abs)
- SET(_glade_list)
- SET(_glade_list_abs)
- SET(_stage "SRC")
- FOREACH(_pot_option ${_pot_options} ${ARGN})
- IF(_pot_option STREQUAL "OPTION")
- SET(_stage "OPTION")
- ELSEIF(_pot_option STREQUAL "SRC")
- SET(_stage "SRC")
- ELSEIF(_pot_option STREQUAL "GLADE")
- SET(_stage "GLADE")
- ELSE(_pot_option STREQUAL "OPTION")
- IF(_stage STREQUAL "OPTION")
- SET(_xgettext_options_list ${_xgettext_options_list} ${_pot_option})
- ELSEIF(_stage STREQUAL "GLADE")
- FILE(RELATIVE_PATH _relFile ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/${_pot_option})
- GET_FILENAME_COMPONENT(_absFile ${_pot_option} ABSOLUTE)
- SET(_glade_list ${_glade_list} ${_relFile})
- SET(_glade_list_abs ${_glade_list_abs} ${_absFile})
- ELSEIF(_stage STREQUAL "SRC")
- FILE(RELATIVE_PATH _relFile ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_pot_option})
- GET_FILENAME_COMPONENT(_absFile ${_pot_option} ABSOLUTE)
- SET(_src_list ${_src_list} ${_relFile})
- SET(_src_list_abs ${_src_list_abs} ${_absFile})
- ENDIF(_stage STREQUAL "OPTION")
- ENDIF(_pot_option STREQUAL "OPTION")
- ENDFOREACH(_pot_option ${_pot_options} ${ARGN})
-
- IF (_xgettext_options_list)
- SET(_xgettext_options ${_xgettext_options_list})
- ELSE(_xgettext_options_list)
- SET(_xgettext_options ${XGETTEXT_OPTIONS})
- ENDIF(_xgettext_options_list)
-
- #MESSAGE("${XGETTEXT_EXECUTABLE} ${_xgettext_options_list} -o ${_potFile} ${_src_list}")
- ADD_CUSTOM_COMMAND(OUTPUT pot_file
- COMMAND ${XGETTEXT_EXECUTABLE} ${_xgettext_options} -o ${_potFile} ${_src_list}
- DEPENDS ${_src_list_abs} ${GLADE_FILES}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
-
- ADD_CUSTOM_TARGET(pot_file
- COMMAND ${XGETTEXT_EXECUTABLE} ${_xgettext_options_list} -o _source.pot ${_src_list}
- COMMAND ${XGETTEXT_EXECUTABLE} --language=Glade --omit-header -o _glade.pot ${_glade_list}
- COMMAND ${GETTEXT_MSGCAT_EXECUTABLE} -o ${_potFile} --use-first _source.pot _glade.pot
- DEPENDS ${_src_list_abs}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Extract translatable messages to ${_potFile}"
- )
- ENDMACRO(GETTEXT_CREATE_POT _potFile _pot_options)
-
-
- MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstLang)
- SET(_gmoFiles)
- GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
- GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
-
- SET(_addToAll)
- SET(_is_comment FALSE)
-
- FOREACH (_currentLang ${_firstLang} ${ARGN})
- IF(_currentLang STREQUAL "ALL")
- SET(_addToAll "ALL")
- ELSEIF(_currentLang STREQUAL "COMMENT")
- SET(_is_comment TRUE)
- ELSEIF(_is_comment)
- SET(_is_comment FALSE)
- SET(_comment ${_currentLang})
- ELSE()
- SET(_lang ${_currentLang})
- GET_FILENAME_COMPONENT(_absFile ${_currentLang}.po ABSOLUTE)
- GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
- SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.mo)
-
- #MESSAGE("_absFile=${_absFile} _abs_PATH=${_abs_PATH} _lang=${_lang} curr_bin=${CMAKE_CURRENT_BINARY_DIR}")
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_gmoFile}
- COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
- DEPENDS ${_absPotFile} ${_absFile}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
-
- INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
- SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
- ENDIF()
- ENDFOREACH (_currentLang )
-
- IF(DEFINED _comment)
- ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles} COMMENT ${_comment})
- ELSE(DEFINED _comment)
- ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
- ENDIF(DEFINED _comment)
- ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
-ENDIF(XGETTEXT_FOUND)
-
-
-
diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake
new file mode 100644
index 0000000..476fb37
--- /dev/null
+++ b/cmake/Translations.cmake
@@ -0,0 +1,41 @@
+# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
+
+macro(add_translations_directory NLS_PACKAGE)
+ add_custom_target (i18n ALL COMMENT “Building i18n messages.”)
+ find_program (MSGFMT_EXECUTABLE msgfmt)
+ file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
+ foreach (PO_INPUT ${PO_FILES})
+ get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
+ set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
+ add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
+
+ install (FILES ${MO_OUTPUT} DESTINATION
+ share/locale/${PO_INPUT_BASE}/LC_MESSAGES
+ RENAME ${NLS_PACKAGE}.mo)
+ endforeach (PO_INPUT ${PO_FILES})
+endmacro(add_translations_directory)
+
+
+macro(add_translations_catalog NLS_PACKAGE)
+ add_custom_target (pot COMMENT “Building translation catalog.”)
+ find_program (XGETTEXT_EXECUTABLE xgettext)
+
+
+ set(C_SOURCE "")
+
+ foreach(FILES_INPUT ${ARGN})
+ file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
+ foreach(C_FILE ${SOURCE_FILES})
+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
+ endforeach()
+ file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
+ foreach(C_FILE ${SOURCE_FILES})
+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
+ endforeach()
+ endforeach()
+
+ add_custom_command (TARGET pot COMMAND
+ ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
+ ${VALA_SOURCE} ${C_SOURCE} --keyword="_" --keyword="N_" --from-code=UTF-8
+ )
+endmacro()
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 0000000..8325f6e
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,3 @@
+include (Translations)
+add_translations_directory ("${GETTEXT_PACKAGE}")
+add_translations_catalog ("${GETTEXT_PACKAGE}" ../src/)
diff --git a/po/LINGUAS b/po/LINGUAS
deleted file mode 100644
index 2f49802..0000000
--- a/po/LINGUAS
+++ /dev/null
@@ -1,99 +0,0 @@
-af
-am
-an
-ar
-ast
-az
-be
-bg
-bn
-bo
-br
-bs
-ca
-ca@valencia
-crh
-csb
-cs
-cv
-cy
-da
-de
-dv
-el
-en_AU
-en_CA
-en_GB
-eo
-es
-et
-eu
-fa
-fi
-fr
-fur
-fy
-gd
-gl
-gu
-gv
-he
-hi
-hr
-hu
-hy
-id
-is
-it
-ja
-ka
-kk
-km
-kn
-ko
-ku
-ky
-lb
-lt
-lv
-mg
-mk
-ml
-mr
-ms
-my
-nb
-ne
-nl
-nn
-ny
-oc
-os
-pa
-pl
-pt_BR
-pt
-ro
-ru
-sc
-sd
-si
-sk
-sl
-sq
-sr
-sv
-ta_LK
-ta
-te
-th
-tr
-tt
-ug
-uk
-ur
-vec
-vi
-zh_CN
-zh_HK
-zh_TW
diff --git a/po/POTFILES.in b/po/POTFILES.in
deleted file mode 100644
index f2cafb0..0000000
--- a/po/POTFILES.in
+++ /dev/null
@@ -1,14 +0,0 @@
-[encoding: UTF-8]
-data/com.canonical.indicator.session.gschema.xml.in
-data/extra-sessions/classic-desktop.desktop.in.in
-src/dialog.c
-src/gen-session-dbus.xml.c
-src/gtk-logout-helper.c
-src/indicator-session.c
-src/online-accounts-mgr.c
-src/session-dbus.c
-src/session-menu-mgr.c
-src/session-service.c
-src/users-service-dbus.c
-src/user-widget.c
-