install translations into mac .app

Add a POST_BUILD hook to run a cmake script to install translations into
the .app.

Tested to work correctly, when system language is different a
translation is loaded.
This commit is contained in:
Rafael Kitover 2018-08-11 14:52:18 -07:00
parent 0092dc16ac
commit bf4606fc18
2 changed files with 21 additions and 1 deletions

View File

@ -652,11 +652,18 @@ if(APPLE)
SET_SOURCE_FILES_PROPERTIES(${VBAM_ICON_PATH} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# bundle dylibs and relink them for releasing .app
# also install translations into the .app
# but only in Release mode
IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/tools/osx/third_party_libs_tool ./visualboyadvance-m.app
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
add_custom_command(TARGET visualboyadvance-m POST_BUILD
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/mac-localizations.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
ENDIF()
endif(APPLE)

View File

@ -0,0 +1,13 @@
# install localizations
file(GLOB gmos "po/wxvbam/*.gmo")
foreach(gmo ${gmos})
# strip path
string(REGEX REPLACE "^.*/" "" gmo ${gmo})
string(REPLACE ".gmo" "" lang ${gmo})
file(MAKE_DIRECTORY "visualboyadvance-m.app/Contents/Resources/${lang}.lproj")
file(COPY "po/wxvbam/${gmo}" DESTINATION "visualboyadvance-m.app/Contents/Resources/${lang}.lproj")
file(RENAME "visualboyadvance-m.app/Contents/Resources/${lang}.lproj/${gmo}" "visualboyadvance-m.app/Contents/Resources/${lang}.lproj/wxvbam.mo")
endforeach()