diff options
author | Diogo Pereira <sir.suriv@gmail.com> | 2016-08-18 05:38:05 +0300 |
---|---|---|
committer | Diogo Pereira <sir.suriv@gmail.com> | 2016-08-18 05:38:05 +0300 |
commit | 0780bb0f8f39adde254401b05cf08a0ff0d865b6 (patch) | |
tree | 8cea42aa37b6fbf87268659ffd811114b7934cfa | |
parent | 31ece3628e06b73203cec0d2914729dfb24f56db (diff) |
make gettext behave correctly
Fixes #178
-rw-r--r-- | cmake/GETTEXT.cmake | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmake/GETTEXT.cmake b/cmake/GETTEXT.cmake index e3056f8cd..ec4987004 100644 --- a/cmake/GETTEXT.cmake +++ b/cmake/GETTEXT.cmake @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. find_suggested_package(Gettext) @@ -24,12 +24,13 @@ function(gettext po_dir package_name) file(GLOB po_files ${po_dir}/*.po) foreach(po_file ${po_files}) get_filename_component(lang ${po_file} NAME_WE) - set(mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) - add_custom_command(OUTPUT ${mo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} DEPENDS ${po_file}) - install(FILES ${mo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME ${package_name}.mo) - set(mo_files ${mo_files} ${mo_file}) + if(("$ENV{LINGUAS}" MATCHES "(^| )${lang}( |$)") OR (NOT DEFINED ENV{LINGUAS})) + set(mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) + add_custom_command(OUTPUT ${mo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} DEPENDS ${po_file}) + install(FILES ${mo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME ${package_name}.mo) + set(mo_files ${mo_files} ${mo_file}) + endif() endforeach() set(translations-target "${package_name}-translations") add_custom_target(${translations-target} ALL DEPENDS ${mo_files}) endfunction() - |