summaryrefslogtreecommitdiffstats
path: root/po
diff options
context:
space:
mode:
authorPeter Åstrand <astrand@cendio.se>2011-04-28 09:29:13 +0000
committerPeter Åstrand <astrand@cendio.se>2011-04-28 09:29:13 +0000
commitbb445ef944f3850de98a6a90b44b1f87c341e989 (patch)
tree4fb275ef8a17570707ef957cc079a1f56466b13a /po
parent37d60d82caadcd765b7491f1b95feb9c8747df63 (diff)
downloadtigervnc-bb445ef944f3850de98a6a90b44b1f87c341e989.tar.gz
tigervnc-bb445ef944f3850de98a6a90b44b1f87c341e989.zip
This patch adds gettext support for our new vncviewer. CMake only. The
change of the project name is to make the CMake build behave like the Autotools build - define PACKAGE_NAME in the same way. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4388 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'po')
-rw-r--r--po/CMakeLists.txt61
1 files changed, 61 insertions, 0 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 00000000..51f01720
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,61 @@
+# Gettext support - mostly borrowed from the Licq project
+
+set(po_FILES
+ de fr pl ru sk sv
+)
+
+if (NOT GETTEXT_MSGMERGE_EXECUTABLE AND NOT GETTEXT_MSGFMT_EXECUTABLE)
+ message(FATAL_ERROR "Gettext message catalog tools NOT found")
+endif (NOT GETTEXT_MSGMERGE_EXECUTABLE AND NOT GETTEXT_MSGFMT_EXECUTABLE)
+
+find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
+if (GETTEXT_XGETTEXT_EXECUTABLE)
+ # Get list of all source files
+ file(GLOB_RECURSE po_source
+ RELATIVE ${PROJECT_SOURCE_DIR}
+ ${PROJECT_SOURCE_DIR}/vncviewer/*.h
+ ${PROJECT_SOURCE_DIR}/vncviewer/*.cxx
+ )
+
+ add_custom_target(translations_update
+ ${GETTEXT_XGETTEXT_EXECUTABLE}
+ --directory ${PROJECT_SOURCE_DIR}
+ --output="${CMAKE_CURRENT_SOURCE_DIR}/tigervnc.pot"
+ --default-domain=tigervnc
+ --keyword=_
+ --keyword=N_
+ --copyright-holder='RealVNC Ltd, Constantin Kaplinsky, Peter Astrand, Cendio AB'
+ --msgid-bugs-address="tigervnc-devel@lists.sourceforge.net"
+ --sort-output
+ --no-location
+ ${po_source}
+ COMMENT "Updating tigervnc.pot"
+ )
+endif (GETTEXT_XGETTEXT_EXECUTABLE)
+
+foreach(lang ${po_FILES})
+ set(po "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po")
+ set(mo "${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo")
+
+ # Update po files after pot file
+ add_custom_command(TARGET translations_update POST_BUILD
+ COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none
+ --sort-output ${po} ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc.pot
+ COMMENT "Updating ${lang}.po"
+ )
+
+ # Add command to build X.mo from X.po
+ add_custom_command(OUTPUT ${mo}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
+ DEPENDS ${po}
+ )
+
+ install(FILES ${mo}
+ DESTINATION "${LOCALE_DIR}/${lang}/LC_MESSAGES"
+ RENAME tigervnc.mo
+ )
+
+ set(moFiles ${moFiles} ${mo})
+endforeach(lang)
+
+add_custom_target(translations ALL DEPENDS ${moFiles})