Skip to content

Commit

Permalink
install translations into mac .app
Browse files Browse the repository at this point in the history
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 bf4606f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/wx/CMakeLists.txt
Expand Up @@ -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)

Expand Down
13 changes: 13 additions & 0 deletions src/wx/mac-localizations.cmake
@@ -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.