Skip to content
Permalink
Browse files

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.
  • Loading branch information...
rkitover committed Aug 11, 2018
1 parent 0092dc1 commit bf4606fc189372588ec31c8bc505349cfcb84ed4
Showing with 21 additions and 1 deletion.
  1. +8 −1 src/wx/CMakeLists.txt
  2. +13 −0 src/wx/mac-localizations.cmake
@@ -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)

@@ -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()

0 comments on commit bf4606f

Please sign in to comment.
You can’t perform that action at this time.