GUI: Move translations to resources directory

Also fixes finding translations in package mode builds
This commit is contained in:
TellowKrinkle 2021-12-12 15:13:51 -06:00 committed by tellowkrinkle
parent 49b1a496b1
commit 1b453d0436
57 changed files with 14 additions and 22 deletions

View File

@ -49,7 +49,6 @@ chmod a+x ./squashfs-root/usr/optional/exec.so
echo "$name" > "$GITHUB_WORKSPACE"/squashfs-root/version.txt
mkdir -p "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/app
mkdir -p "$GITHUB_WORKSPACE"/squashfs-root/apprun-hooks
cp -r "$GITHUB_WORKSPACE"/bin/Langs "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/
cp -r "$GITHUB_WORKSPACE"/bin/resources "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/app/
cp "$GITHUB_WORKSPACE"/bin/docs/{Configuration_Guide.pdf,PCSX2_FAQ.pdf} "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/app
cp /usr/lib/$LIBARCH/libthai.so.0 "$GITHUB_WORKSPACE"/squashfs-root/usr/lib/

View File

@ -62,8 +62,8 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg)
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})
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:PCSX2>/../Resources/locale/${_lang}/"
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o "$<TARGET_FILE_DIR:PCSX2>/../Resources/locale/${_lang}/${_potBasename}.mo" ${_mnemonicless})
ELSE (APPLE)
SET(_extraCommands)
ENDIF (APPLE)
@ -86,9 +86,9 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg)
ENDIF (CMAKE_BUILD_PO)
IF (PACKAGE_MODE)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/PCSX2/resources/locale/${_lang} RENAME ${_potBasename}.mo)
ELSE (PACKAGE_MODE)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_SOURCE_DIR}/bin/Langs/${_lang} RENAME ${_potBasename}.mo)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_SOURCE_DIR}/bin/resources/locale/${_lang} RENAME ${_potBasename}.mo)
ENDIF (PACKAGE_MODE)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile})

View File

@ -1646,6 +1646,9 @@ foreach(path IN LISTS RESOURCE_FILES)
if (NOT WIN32 AND "${path}" MATCHES "/dx11/") # Don't include unneccessary stuff
continue()
endif()
if ((GETTEXT_FOUND OR NO_TRANSLATION) AND "${path}" MATCHES "/locale/") # Generate locales with gettext instead of copying them from bin
continue()
endif()
pcsx2_resource(${path} ${CMAKE_SOURCE_DIR}/bin/resources/)
endforeach()

View File

@ -87,7 +87,7 @@ namespace PathDefs
const wxDirName& Langs()
{
static const wxDirName retval(L"Langs");
static const wxDirName retval(L"locale");
return retval;
}
@ -240,15 +240,6 @@ namespace PathDefs
return GetDocuments() + Base::Logs();
}
wxDirName GetLangs()
{
#ifdef __APPLE__
return wxDirName(wxStandardPaths::Get().GetResourcesDir());
#else
return AppRoot() + Base::Langs();
#endif
}
wxDirName GetResources()
{
// ifdef is only needed here because mac doesn't put its resources in a subdirectory..
@ -259,6 +250,11 @@ namespace PathDefs
#endif
}
wxDirName GetLangs()
{
return GetResources() + Base::Langs();
}
wxDirName GetCache()
{
return GetDocuments() + Base::Cache();

View File

@ -359,11 +359,5 @@ bool i18n_SetLanguage( wxLanguage wxLangId, const wxString& langCode )
// This method sets the lookup path to search l10n files
void i18n_SetLanguagePath()
{
// default location for windows
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
// additional location for linux
#if defined(__unix__) || defined(__APPLE__)
wxLocale::AddCatalogLookupPathPrefix( PathDefs::GetLangs().ToString() );
#endif
wxLocale::AddCatalogLookupPathPrefix(PathDefs::GetLangs().ToString());
}