Review Request 117560: ECMCreateQmFromPoFiles: adjust API to make it usable from within trunk/l10n-kf5

Commit Hook null at kde.org
Wed Apr 16 08:28:36 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117560/#review55845
-----------------------------------------------------------


This review has been submitted with commit 071581a3f899c881c9938efd082fd32589822b45 by Aurélien Gâteau to branch master.

- Commit Hook


On April 15, 2014, 3:36 p.m., Aurélien Gâteau wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117560/
> -----------------------------------------------------------
> 
> (Updated April 15, 2014, 3:36 p.m.)
> 
> 
> Review request for Build System, Extra Cmake Modules and KDE Frameworks.
> 
> 
> Repository: extra-cmake-modules
> 
> 
> Description
> -------
> 
> Translators (are going to) translate KF5 in trunk/l10n-kf5 ( http://websvn.kde.org/trunk/l10n-kf5/ ). It is necessary to support their work-flow, which consists of:
> 1) build the code from git
> 2) builds and installs all translations from one language
> 
> The patch makes several changes to ECMCreateQmFromPoFiles to support this work-flow:
> 
> - It splits the code into two functions: one to create the .qm and install them, another to build the .qm loader. This way the loader can be generated even if no translations are available.
> 
> - It changes the syntax of ecm_create_qm_from_po_files() to accept po files instead of a po directory. This is needed because within the same language directory some .po are going to be turned into .qm while others are turned into .mo.
> 
> - It creates "translation-N" targets (like CMake gettext code does) to support multiple calls within one cmake project.
> 
> - It installs to share/locale/<lang>/LC_MESSAGES (like gettext), because l10n-kf5 build system cannot know where the framework would decide to keep its .qm file, so it's simpler to use a standard place.
> 
> This potentially breaks existing framework builds, but only for developers who created manually po/ directories in their work tree (almost nobody, I expect), so I think it can be pushed as is. I already have the code ready to fix existing frameworks.
> 
> Those changes still support shipping translations within frameworks tarballs. Assuming this patch gets in, the build system of each framework is going to be patched like this:
> 
> -----------------------------------------------------
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index b5e445c..c9a706c 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -16,6 +16,8 @@ include(GenerateExportHeader)
>  include(ECMSetupVersion)
>  include(ECMGenerateHeaders)
>  
> +include(ECMCreateQmFromPoFiles)
> +
>  set(KF5_VERSION "4.98.0")
>  
>  ecm_setup_version(${KF5_VERSION}
> @@ -37,14 +39,9 @@ if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
>    find_package(KF5XmlGui ${KF5_VERSION} REQUIRED)
>  endif()
>  
> -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/po)
> -  include(ECMCreateQmFromPoFiles)
> -  ecm_create_qm_from_po_files(
> -    PO_DIR po
> -    POT_NAME kbookmarks5.pot
> -    DATA_INSTALL_SUB_DIR kbookmarks
> -    CREATE_LOADER kbookmarks_QM_LOADER
> -  )
> +file(GLOB PO_FILES "po/*.po")
> +if (PO_FILES)
> +  ecm_create_qm_from_po_files(PO_FILES ${PO_FILES} CATALOG_NAME kbookmarks5)
>  endif()
>  
>  add_subdirectory(src)
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 676b172..faa25e1 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -1,6 +1,8 @@
>  # TODO
>  remove_definitions(-DQT_NO_CAST_FROM_ASCII)
>  
> +ecm_create_qm_loader(kbookmarks_QM_LOADER kbookmarks5)
> +
>  set(kbookmarks_SRCS
>    kbookmark.cpp
>    kbookmarkaction.cpp
> -----------------------------------------------------
> 
> 
> Diffs
> -----
> 
>   modules/ECMCreateQmFromPoFiles.cmake 92d0d1a 
>   modules/ECMQmLoader.cpp.in 4fd9c11 
> 
> Diff: https://git.reviewboard.kde.org/r/117560/diff/
> 
> 
> Testing
> -------
> 
> Built translations for KF5 from within frameworks source and from a patched l10n-kf5.
> 
> 
> Thanks,
> 
> Aurélien Gâteau
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140416/d033dbe2/attachment.html>


More information about the Kde-frameworks-devel mailing list