diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-09 00:44:48 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-09 00:44:48 +0400 |
commit | ac6d91b9396c15d8bf1aa550adb4ca8c7125dd81 (patch) | |
tree | 88d1f046c6548331fdb705f91fcc63b8595f9f03 /source/creator | |
parent | 0d1a49936627f2885b058f23920490bc6ed7c282 (diff) |
Be ready for changes in bf-translations repository
Made it so if there's release/datafiles/locale/po
folder, then all the .po files will be converted
to .mo at blender compile time and installed to
an appropriate location.
Uses small own implementation msgfmt which is
based on msgfmt.py from Python project, but also
supports contexts.
There's no functional changes for until we've
switched to use source .po files instead of
pre-compiled .mo.
P.S. Well, there's one change which is msgfmt.cc
being compiled even if it's not used, but
would rather not clutter code with checks
since pretty soon we'll use this program
anyway.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 33d5c7dc90b..b386312bb55 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -318,11 +318,59 @@ endif() if(WITH_INTERNATIONAL) install( DIRECTORY - ${CMAKE_SOURCE_DIR}/release/datafiles/locale ${CMAKE_SOURCE_DIR}/release/datafiles/fonts DESTINATION ${TARGETDIR_VER}/datafiles PATTERN ".svn" EXCLUDE ) + + set(_locale_dir "${CMAKE_SOURCE_DIR}/release/datafiles/locale") + + if(EXISTS "${_locale_dir}/po") + set(_locale_target_dir ${TARGETDIR_VER}/datafiles/locale) + + file(GLOB _po_files "${_locale_dir}/po/*.po") + foreach(_po_file ${_po_files}) + msgfmt_simple(${_po_file} _all_mo_files) + endforeach() + + # Create a custom target which will compile all po to mo + add_custom_target( + locales + DEPENDS ${_all_mo_files}) + + add_dependencies(blender locales) + + # Generate INSTALL rules + install( + FILES ${_locale_dir}/languages + DESTINATION ${_locale_target_dir} + ) + + foreach(_mo_file ${_all_mo_files}) + get_filename_component(_locale_name ${_mo_file} NAME_WE) + install( + FILES ${_mo_file} + DESTINATION ${_locale_target_dir}/${_locale_name}/LC_MESSAGES + RENAME blender.mo + ) + unset(_locale_name) + endforeach() + + unset(_all_mo_files) + unset(_po_files) + unset(_po_file) + unset(_mo_file) + unset(_locale_target_dir) + else() + install( + DIRECTORY + ${_locale_dir} + DESTINATION ${TARGETDIR_VER}/datafiles + PATTERN ".svn" EXCLUDE + ) + endif() + + unset(_locale_dir) endif() # color management |