[geary: 26/39] Replace intltool with gettext. Bug 771643.



commit 39ef8e3e2d5a2dc8ef98af25e4f154da7aefb58c
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Dec 23 00:02:09 2016 +0100

    Replace intltool with gettext. Bug 771643.
    
    Signed-off-by: Niels De Graef <nielsdegraef gmail com>

 CMakeLists.txt                              |   13 +++-
 INSTALL                                     |    4 +-
 cmake/FindIntltool.cmake                    |   44 --------------
 cmake/{Gettext.cmake => FindXGettext.cmake} |   84 ++++++++++++++++-----------
 debian/control                              |    1 -
 desktop/CMakeLists.txt                      |   51 ++++++++++------
 desktop/geary-attach.contract.in            |    4 +-
 desktop/geary-autostart.desktop.in          |   10 ++--
 desktop/org.gnome.Geary.appdata.xml.in      |   28 +++++-----
 desktop/org.gnome.Geary.desktop.in          |   12 ++--
 po/POTFILES.in                              |   59 +++++++++----------
 11 files changed, 149 insertions(+), 161 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3199468..67bfeb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,12 +137,17 @@ endif()
 
 find_package(Git QUIET)
 
-# intl
-include(Gettext)
+# xgettext
+include(FindXGettext)
+SET(MIN_XGETTEXT_VERSION "0.19.8")
 if (XGETTEXT_FOUND)
-    message(STATUS "xgettext found")
+    if (XGETTEXT_VERSION VERSION_LESS MIN_XGETTEXT_VERSION)
+        message (FATAL_ERROR "xgettext found, but version is ${XGETTEXT_VERSION} (minimum version required 
is ${MIN_XGETTEXT_VERSION}).")
+    else ()
+        message(STATUS "xgettext found, version ${XGETTEXT_VERSION}")
+    endif ()
 else ()
-    message(STATUS "xgettext not found")
+    message (FATAL_ERROR "xgettext not found")
 endif ()
 
 # GResources
diff --git a/INSTALL b/INSTALL
index 2fe6cc4..44962ec 100644
--- a/INSTALL
+++ b/INSTALL
@@ -63,7 +63,7 @@
     Fedora 25 and later ships with the correct versions of the
     required libraries. Install them by running this command:
 
-        $ sudo dnf install vala gobject-introspection-devel intltool cmake \
+        $ sudo yum install vala gobject-introspection-devel cmake \
             desktop-file-utils gnome-doc-utils libcanberra-devel libgee-devel \
             glib2-devel gmime-devel gtk3-devel libnotify-devel sqlite-devel \
             webkitgtk4-devel libsecret-devel libxml2-devel vala-tools \
@@ -82,7 +82,7 @@
 
     Install them by running this command:
 
-        $ sudo apt-get install valac libgirepository1.0-dev intltool \
+        $ sudo apt-get install valac libgirepository1.0-dev \
             cmake desktop-file-utils gnome-doc-utils libcanberra-dev \
             libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev libgtk-3-dev \
             libsecret-1-dev libxml2-dev libnotify-dev libsqlite3-dev \
diff --git a/cmake/Gettext.cmake b/cmake/FindXGettext.cmake
similarity index 57%
rename from cmake/Gettext.cmake
rename to cmake/FindXGettext.cmake
index 3247b3b..c6437f8 100644
--- a/cmake/Gettext.cmake
+++ b/cmake/FindXGettext.cmake
@@ -21,6 +21,7 @@
 #  GETTEXT_FOUND: True if gettext has been found.
 #  XGETTEXT_EXECUTABLE: the full path to the xgettext.
 #  XGETTEXT_FOUND: True if xgettext has been found.
+#  XGETTEXT_VERSION: The xgettext version.
 #
 #===================================================================
 # Macros:
@@ -55,66 +56,81 @@ 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})
 
+# Check for gettext
 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")
+        MESSAGE(FATAL_ERROR "GetText not found")
     ENDIF (GetText_REQUIRED)
 ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE AND GETTEXT_MSGCAT_EXECUTABLE)
 
+# Check xgettext and the version
 IF(XGETTEXT_EXECUTABLE)
     SET(XGETTEXT_FOUND TRUE)
+
+    # Liberally taken from
+    # https://github.com/boghison/mixcloudscope/blob/master/cmake/FindXGettext.cmake
+    execute_process(COMMAND ${XGETTEXT_EXECUTABLE} --version
+                    OUTPUT_VARIABLE _xgettext_version
+                    ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+    if (_xgettext_version MATCHES "^xgettext \\(.*\\) [0-9]")
+        string(
+            REGEX REPLACE "^xgettext \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1"
+            XGETTEXT_VERSION "${_xgettext_version}"
+        )
+    endif()
+    unset(_xgettext_version)
 ELSE(XGETTEXT_EXECUTABLE)
     MESSAGE(STATUS "xgettext not found.")
     SET(XGETTTEXT_FOUND FALSE)
 ENDIF(XGETTEXT_EXECUTABLE)
 
+# Set the default options if not specified
 IF(NOT DEFINED XGETTEXT_OPTIONS)
     SET(XGETTEXT_OPTIONS ${XGETTEXT_OPTIONS_DEFAULT})
 ENDIF(NOT DEFINED XGETTEXT_OPTIONS)
 
+# Add translations target
 IF(XGETTEXT_FOUND)
     MACRO(GETTEXT_CREATE_TRANSLATIONS _firstLang)
-       SET(_gmoFiles)
-       SET(_addToAll)
-       SET(_is_comment FALSE)
+        SET(_gmoFiles)
+        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)
+        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_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
-                   DEPENDS ${_absFile}
-                   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-                   )
+                #MESSAGE("_absFile=${_absFile} _abs_PATH=${_abs_PATH} _lang=${_lang} 
curr_bin=${CMAKE_CURRENT_BINARY_DIR}")
+                ADD_CUSTOM_COMMAND(
+                    OUTPUT ${_gmoFile}
+                    COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+                    DEPENDS ${_absFile}
+                    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+                    )
 
                 INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME 
${GETTEXT_PACKAGE}.mo)
-               SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
-           ENDIF()
-       ENDFOREACH (_currentLang )
+                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)
+        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/debian/control b/debian/control
index e68f86a..61ffd31 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,6 @@ Build-Depends: debhelper (>= 8),
  libsqlite3-dev (>= 3.7.4),
  libmessaging-menu-dev (>= 12.10.2),
  libunity-dev (>= 5.12.0),
- intltool,
  libgirepository1.0-dev (>= 1.32.0),
  desktop-file-utils,
  gnome-doc-utils,
diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt
index 927c9d4..6f0d0b3 100644
--- a/desktop/CMakeLists.txt
+++ b/desktop/CMakeLists.txt
@@ -2,24 +2,34 @@
 # Build and install org.gnome.Geary.desktop
 #
 
-include (FindIntltool)
 include (FindDesktopFileValidate)
-if (INTLTOOL_MERGE_FOUND)
-    INTLTOOL_MERGE_APPDATA (org.gnome.Geary.appdata.xml po)
-    INTLTOOL_MERGE_DESKTOP (org.gnome.Geary.desktop po)
-    INTLTOOL_MERGE_AUTOSTART_DESKTOP (geary-autostart.desktop po)
 
-    if (DESKTOP_VALIDATE)
-        if (DESKTOP_FILE_VALIDATE_FOUND)
-            VALIDATE_DESKTOP_FILE (org.gnome.Geary.desktop)
-            VALIDATE_DESKTOP_FILE (geary-autostart.desktop)
-        else (DESKTOP_FILE_VALIDATE_FOUND)
-            message (FATAL_ERROR "desktop-file-validate must be installed to validate generated .desktop 
file")
-        endif (DESKTOP_FILE_VALIDATE_FOUND)
-    endif (DESKTOP_VALIDATE)
-else (INTLTOOL_MERGE_FOUND)
-    message (FATAL_ERROR "intltool must be installed to generate .desktop file")
-endif (INTLTOOL_MERGE_FOUND)
+add_custom_target (org.gnome.Geary.appdata.xml ALL
+    ${GETTEXT_MSGFMT_EXECUTABLE} --xml -d '${CMAKE_SOURCE_DIR}/po'
+        --template '${CMAKE_CURRENT_SOURCE_DIR}/org.gnome.Geary.appdata.xml.in' -o 
org.gnome.Geary.appdata.xml
+)
+add_custom_target (org.gnome.Geary.desktop ALL
+    ${GETTEXT_MSGFMT_EXECUTABLE} --desktop -d '${CMAKE_SOURCE_DIR}/po'
+        --template '${CMAKE_CURRENT_SOURCE_DIR}/org.gnome.Geary.desktop.in' -o org.gnome.Geary.desktop
+)
+add_custom_target (geary-autostart.desktop ALL
+    ${GETTEXT_MSGFMT_EXECUTABLE} --desktop -d '${CMAKE_SOURCE_DIR}/po'
+        --template '${CMAKE_CURRENT_SOURCE_DIR}/geary-autostart.desktop.in' -o geary-autostart.desktop
+)
+
+if (DESKTOP_VALIDATE)
+    if (DESKTOP_FILE_VALIDATE_FOUND)
+        VALIDATE_DESKTOP_FILE (org.gnome.Geary.desktop)
+        VALIDATE_DESKTOP_FILE (geary-autostart.desktop)
+    else (DESKTOP_FILE_VALIDATE_FOUND)
+        message (FATAL_ERROR "desktop-file-validate must be installed to validate generated .desktop file")
+    endif (DESKTOP_FILE_VALIDATE_FOUND)
+endif (DESKTOP_VALIDATE)
+
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/org.gnome.Geary.appdata.xml DESTINATION 
${CMAKE_INSTALL_PREFIX}/share/metainfo)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/org.gnome.Geary.desktop DESTINATION 
${CMAKE_INSTALL_PREFIX}/share/applications)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/geary-autostart.desktop DESTINATION 
${CMAKE_INSTALL_PREFIX}/share/applications)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/geary-attach.contract DESTINATION 
${CMAKE_INSTALL_PREFIX}/share/contractor)
 
 # Optional: run update-desktop-database at install time.
 # (This has to happen after the org.gnome.Geary.desktop file is installed.)
@@ -48,8 +58,11 @@ if (DISABLE_CONTRACT)
     message (STATUS "Install Contractor contract: OFF")
 else (DISABLE_CONTRACT)
     message (STATUS "Install Contractor contract: ON")
-    if (INTLTOOL_MERGE_FOUND)
-        INTLTOOL_MERGE_CONTRACT (geary-attach.contract po)
+    if (GETTEXT_FOUND)
+        add_custom_target (geary-attach.contract ALL
+            ${GETTEXT_MSGFMT_EXECUTABLE} --desktop -d '${CMAKE_SOURCE_DIR}/po'
+                --template '${CMAKE_CURRENT_SOURCE_DIR}/geary-attach.contract.in' -o geary-attach.contract
+        )
 
 # Can't validate Contractor file since it isn't a valid Desktop
 # file according to desktop-file-validate from desktop-file-utils 0.22:
@@ -63,6 +76,6 @@ else (DISABLE_CONTRACT)
 #                VALIDATE_DESKTOP_FILE (geary-attach.contract)
 #            endif (DESKTOP_FILE_VALIDATE_FOUND)
 #        endif (DESKTOP_VALIDATE)
-    endif (INTLTOOL_MERGE_FOUND)
+    endif (GETTEXT_FOUND)
     install (PROGRAMS geary-attach DESTINATION bin)
 endif (DISABLE_CONTRACT)
diff --git a/desktop/geary-attach.contract.in b/desktop/geary-attach.contract.in
index 1ebd4f4..298c6e0 100644
--- a/desktop/geary-attach.contract.in
+++ b/desktop/geary-attach.contract.in
@@ -1,6 +1,6 @@
 [Contractor Entry]
-_Name=Send by email
+Name=Send by email
 Icon=mail-send
-_Description=Send files using Geary
+Description=Send files using Geary
 MimeType=!inode;
 Exec=geary-attach %F
diff --git a/desktop/geary-autostart.desktop.in b/desktop/geary-autostart.desktop.in
index c6d5a6d..c0b6dd2 100644
--- a/desktop/geary-autostart.desktop.in
+++ b/desktop/geary-autostart.desktop.in
@@ -1,9 +1,9 @@
 [Desktop Entry]
-_Name=Geary
-_GenericName=Email
-_X-GNOME-FullName=Geary Mail
-_Comment=Send and receive email
-_Keywords=Email;E-mail;Mail;
+Name=Geary
+GenericName=Email
+X-GNOME-FullName=Geary Mail
+Comment=Send and receive email
+Keywords=Email;E-mail;Mail;
 Icon=geary
 TryExec=geary
 Exec=geary --hidden
diff --git a/desktop/org.gnome.Geary.appdata.xml.in b/desktop/org.gnome.Geary.appdata.xml.in
index 02f1109..3012cfb 100644
--- a/desktop/org.gnome.Geary.appdata.xml.in
+++ b/desktop/org.gnome.Geary.appdata.xml.in
@@ -8,29 +8,29 @@
   <update_contact>geary-list gnome org</update_contact>
 
   <!-- Translators: The application name -->
-  <_name>Geary</_name>
+  <name>Geary</name>
   <!-- Translators: The development team's name -->
-  <_developer_name>Geary Development Team</_developer_name>
+  <developer_name>Geary Development Team</developer_name>
   <!-- Translators: The application's summary / tagline -->
-  <_summary>Send and receive email</_summary>
+  <summary>Send and receive email</summary>
   <description>
-    <_p>
+    <p>
       Geary is an email application built around conversations, for
       the GNOME 3 desktop. It allows you to read, find and send email
       with a straightforward, modern interface.
-    </_p>
-    <_p>
+    </p>
+    <p>
       Conversations allow you to read a complete discussion without
       having to find and click from message to message.
-    </_p>
-    <_p>Geary’s features include:</_p>
+    </p>
+    <p>Geary’s features include:</p>
     <ul>
-      <_li>Quick email account setup</_li>
-      <_li>Shows related messages together in conversations</_li>
-      <_li>Fast, full text and keyword search</_li>
-      <_li>Full-featured HTML and plain text message composer</_li>
-      <_li>Desktop notification of new mail</_li>
-      <_li>Compatible with GMail, Yahoo! Mail, Outlook.com and other IMAP servers</_li>
+      <li>Quick email account setup</li>
+      <li>Shows related messages together in conversations</li>
+      <li>Fast, full text and keyword search</li>
+      <li>Full-featured HTML and plain text message composer</li>
+      <li>Desktop notification of new mail</li>
+      <li>Compatible with GMail, Yahoo! Mail, Outlook.com and other IMAP servers</li>
     </ul>
   </description>
 
diff --git a/desktop/org.gnome.Geary.desktop.in b/desktop/org.gnome.Geary.desktop.in
index 3935cbf..62a4772 100644
--- a/desktop/org.gnome.Geary.desktop.in
+++ b/desktop/org.gnome.Geary.desktop.in
@@ -1,10 +1,10 @@
 [Desktop Entry]
-_Name=Geary
-_GenericName=Email
-_X-GNOME-FullName=Geary Email
-_Comment=Send and receive email
+Name=Geary
+GenericName=Email
+X-GNOME-FullName=Geary Email
+Comment=Send and receive email
 # Translators: These are desktop search terms. Do not translate semicolons, end line with a semicolon.
-_Keywords=Mail;E-mail;IMAP;GMail;Yahoo;Hotmail;Outlook;
+Keywords=Mail;E-mail;IMAP;GMail;Yahoo;Hotmail;Outlook;
 Icon=geary
 TryExec=geary
 Exec=geary %U
@@ -16,5 +16,5 @@ StartupNotify=true
 Actions=Compose;
 
 [Desktop Action Compose]
-_Name=Compose Message
+Name=Compose Message
 Exec=geary mailto:
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 271ab79..cb893d4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,7 @@
-[encoding: UTF-8]
 desktop/org.gnome.Geary.appdata.xml.in
 desktop/org.gnome.Geary.desktop.in
 desktop/geary-autostart.desktop.in
-[type: gettext/ini]desktop/geary-attach.contract.in
+desktop/geary-attach.contract.in
 src/geary-version.vala.in
 src/client/accounts/account-dialog-account-list-pane.vala
 src/client/accounts/account-dialog-add-edit-pane.vala
@@ -385,31 +384,31 @@ src/engine/util/util-time.vala
 src/engine/util/util-timeout-manager.vala
 src/engine/util/util-trillian.vala
 src/mailer/main.vala
-[type: gettext/glade]ui/account_cannot_remove.glade
-[type: gettext/glade]ui/account_list.glade
-[type: gettext/glade]ui/account_spinner.glade
-[type: gettext/glade]ui/certificate_warning_dialog.glade
-[type: gettext/glade]ui/composer-headerbar.ui
-[type: gettext/glade]ui/composer-link-popover.ui
-[type: gettext/glade]ui/composer-menus.ui
-[type: gettext/glade]ui/composer-widget.ui
-[type: gettext/glade]ui/conversation-email.ui
-[type: gettext/glade]ui/conversation-email-attachment-view.ui
-[type: gettext/glade]ui/conversation-email-menus.ui
-[type: gettext/glade]ui/conversation-message-menus.ui
-[type: gettext/glade]ui/conversation-message.ui
-[type: gettext/glade]ui/conversation-viewer.ui
-[type: gettext/glade]ui/edit_alternate_emails.glade
-[type: gettext/glade]ui/empty-placeholder.ui
-[type: gettext/glade]ui/find_bar.glade
-[type: gettext/glade]ui/folder-popover.ui
-[type: gettext/glade]ui/gtk/help-overlay.ui
-[type: gettext/glade]ui/gtk/menus.ui
-[type: gettext/glade]ui/login.glade
-[type: gettext/glade]ui/main-toolbar.ui
-[type: gettext/glade]ui/main-toolbar-menus.ui
-[type: gettext/glade]ui/main-window.ui
-[type: gettext/glade]ui/password-dialog.glade
-[type: gettext/glade]ui/preferences-dialog.ui
-[type: gettext/glade]ui/remove_confirm.glade
-[type: gettext/glade]ui/upgrade_dialog.glade
+ui/account_cannot_remove.glade
+ui/account_list.glade
+ui/account_spinner.glade
+ui/certificate_warning_dialog.glade
+ui/composer-headerbar.ui
+ui/composer-link-popover.ui
+ui/composer-menus.ui
+ui/composer-widget.ui
+ui/conversation-email.ui
+ui/conversation-email-attachment-view.ui
+ui/conversation-email-menus.ui
+ui/conversation-message-menus.ui
+ui/conversation-message.ui
+ui/conversation-viewer.ui
+ui/edit_alternate_emails.glade
+ui/empty-placeholder.ui
+ui/find_bar.glade
+ui/folder-popover.ui
+ui/gtk/help-overlay.ui
+ui/gtk/menus.ui
+ui/login.glade
+ui/main-toolbar.ui
+ui/main-window.ui
+ui/main-toolbar-menus.ui
+ui/password-dialog.glade
+ui/preferences-dialog.ui
+ui/remove_confirm.glade
+ui/upgrade_dialog.glade


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]