mirror of https://github.com/PCSX2/pcsx2.git
macOS:i18n: Include translations in app bundle
This commit is contained in:
parent
5470f7ff5e
commit
91e8e0d33c
|
@ -52,6 +52,21 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg)
|
||||||
GET_FILENAME_COMPONENT(_gmoBase ${_absFile} NAME_WE)
|
GET_FILENAME_COMPONENT(_gmoBase ${_absFile} NAME_WE)
|
||||||
GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE)
|
GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE)
|
||||||
SET(_gmoFile ${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.gmo)
|
SET(_gmoFile ${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.gmo)
|
||||||
|
IF (APPLE)
|
||||||
|
# CMake doesn't support generator expressions as the OUTPUT of a custom command
|
||||||
|
# Instead, use ${_gmoFile} to detect changes, and output to the bundle as a side effect
|
||||||
|
# In addition, we have have to preprocess the po files to remove mnemonics:
|
||||||
|
# On Windows, menu items have "mnemonics", the items with a letter underlined that you can use with alt to select menu items. MacOS doesn't do this.
|
||||||
|
# Some languages don't use easily-typable characters, so it's common to add a dedicated character for the mnemonic (e.g. in Japanese on Windows, the File menu would be "ファイル(&F)").
|
||||||
|
# On MacOS, these extra letters in parentheses are useless and should be avoided.
|
||||||
|
SET(_mnemonicless "${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.nomnemonic.po")
|
||||||
|
SET(_extraCommands
|
||||||
|
COMMAND sed -e "\"s/[(]&[A-Za-z][)]//g\"" "${_absFile}" > "${_mnemonicless}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:PCSX2>/../Resources/${_lang}/"
|
||||||
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o "$<TARGET_FILE_DIR:PCSX2>/../Resources/${_lang}/${_potBasename}.mo" ${_mnemonicless})
|
||||||
|
ELSE (APPLE)
|
||||||
|
SET(_extraCommands)
|
||||||
|
ENDIF (APPLE)
|
||||||
|
|
||||||
IF (_currentPoFile MATCHES "\\.git")
|
IF (_currentPoFile MATCHES "\\.git")
|
||||||
continue()
|
continue()
|
||||||
|
@ -61,10 +76,12 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg)
|
||||||
ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}
|
ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}
|
||||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
|
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
|
||||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
||||||
|
${_extraCommands}
|
||||||
DEPENDS ${_absPotFile} ${_absFile} )
|
DEPENDS ${_absPotFile} ${_absFile} )
|
||||||
ELSE (CMAKE_BUILD_PO)
|
ELSE (CMAKE_BUILD_PO)
|
||||||
ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}
|
ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}
|
||||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
||||||
|
${_extraCommands}
|
||||||
DEPENDS ${_absPotFile} ${_absFile} )
|
DEPENDS ${_absPotFile} ${_absFile} )
|
||||||
ENDIF (CMAKE_BUILD_PO)
|
ENDIF (CMAKE_BUILD_PO)
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,11 @@ namespace PathDefs
|
||||||
|
|
||||||
wxDirName GetLangs()
|
wxDirName GetLangs()
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
return wxDirName(wxStandardPaths::Get().GetResourcesDir());
|
||||||
|
#else
|
||||||
return AppRoot() + Base::Langs();
|
return AppRoot() + Base::Langs();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDirName Get( FoldersEnum_t folderidx )
|
wxDirName Get( FoldersEnum_t folderidx )
|
||||||
|
|
|
@ -362,7 +362,7 @@ void i18n_SetLanguagePath()
|
||||||
// default location for windows
|
// default location for windows
|
||||||
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
||||||
// additional location for linux
|
// additional location for linux
|
||||||
#ifdef __unix__
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
wxLocale::AddCatalogLookupPathPrefix( PathDefs::GetLangs().ToString() );
|
wxLocale::AddCatalogLookupPathPrefix( PathDefs::GetLangs().ToString() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue