mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-08 16:55:39 +02:00
translations: fix on macOS
- fix translations path - generate .lproj folders for supported languages to be recognized by QLocale. https://bugreports.qt.io/browse/QTBUG-72491 Gitlab: #578 Change-Id: Ic4c3b74c654a1c00de71c31c9debe397990870f7
This commit is contained in:
parent
3821b78b80
commit
6298932c7f
3 changed files with 21 additions and 10 deletions
|
@ -635,24 +635,27 @@ else()
|
|||
|
||||
# translations
|
||||
if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
|
||||
message("Releasing and copying translation files")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/share/ring/translations/")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/share/libringclient/translations/")
|
||||
set(LRC ${PROJECT_SOURCE_DIR}/../lrc)
|
||||
set(APP_CONTAINER "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents")
|
||||
file(GLOB TS_CLIENT_FILES ${PROJECT_SOURCE_DIR}/translations/*.ts)
|
||||
file(GLOB TS_LRC_FILES ${LRC}/translations/*.ts)
|
||||
|
||||
# generate lproj folders
|
||||
FOREACH(QM_FILE ${TS_LRC_FILES})
|
||||
# Extract language code from filename
|
||||
GET_FILENAME_COMPONENT(FILENAME ${QM_FILE} NAME_WE)
|
||||
STRING(REGEX REPLACE "^lrc_" "" LANG ${FILENAME})
|
||||
file(MAKE_DIRECTORY ${APP_CONTAINER}/Resources/${LANG}.lproj)
|
||||
ENDFOREACH()
|
||||
set_source_files_properties(${TS_CLIENT_FILES} PROPERTIES OUTPUT_LOCATION
|
||||
"${CMAKE_BINARY_DIR}/share/ring/translations")
|
||||
"${APP_CONTAINER}/Resources/share/ring/translations")
|
||||
set_source_files_properties(${TS_LRC_FILES} PROPERTIES OUTPUT_LOCATION
|
||||
"${CMAKE_BINARY_DIR}/share/libringclient/translations")
|
||||
"${APP_CONTAINER}/Resources/share/libringclient/translations")
|
||||
|
||||
qt_add_translation(QM_CLIENT_FILES ${TS_CLIENT_FILES})
|
||||
qt_add_translation(QM_LRC_FILES ${TS_LRC_FILES})
|
||||
target_sources(${PROJECT_NAME} PRIVATE ${QM_CLIENT_FILES})
|
||||
target_sources(${PROJECT_NAME} PRIVATE ${QM_LRC_FILES})
|
||||
install(DIRECTORY "${CMAKE_BINARY_DIR}/share/ring/translations/"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/ring/translations)
|
||||
install(DIRECTORY "${CMAKE_BINARY_DIR}/share/libringclient/translations/"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/libringclient/translations)
|
||||
endif()
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
|
|
|
@ -62,6 +62,10 @@ AppSettingsManager::loadTranslations()
|
|||
{
|
||||
#if defined(Q_OS_LINUX) && defined(JAMI_INSTALL_PREFIX)
|
||||
QString appDir = JAMI_INSTALL_PREFIX;
|
||||
#elif defined(Q_OS_MACOS)
|
||||
QDir dir(qApp->applicationDirPath());
|
||||
dir.cdUp();
|
||||
QString appDir = dir.absolutePath() + "/Resources/share";
|
||||
#else
|
||||
QString appDir = qApp->applicationDirPath() + QDir::separator() + "share";
|
||||
#endif
|
||||
|
@ -125,4 +129,4 @@ AppSettingsManager::loadTranslations()
|
|||
}
|
||||
|
||||
Q_EMIT retranslate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,6 +425,10 @@ UtilsAdapter::supportedLang()
|
|||
{
|
||||
#if defined(Q_OS_LINUX) && defined(JAMI_INSTALL_PREFIX)
|
||||
QString appDir = JAMI_INSTALL_PREFIX;
|
||||
#elif defined(Q_OS_MACOS)
|
||||
QDir dir(qApp->applicationDirPath());
|
||||
dir.cdUp();
|
||||
QString appDir = dir.absolutePath() + "/Resources/share";
|
||||
#else
|
||||
QString appDir = qApp->applicationDirPath() + QDir::separator() + "share";
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue