@@ -368,6 +368,8 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(INSTALL_TRANSLATIONS "Install translations" OFF)
|
||||||
|
|
||||||
optional_component(SUBSONIC ON "Subsonic support")
|
optional_component(SUBSONIC ON "Subsonic support")
|
||||||
optional_component(TIDAL ON "Tidal support")
|
optional_component(TIDAL ON "Tidal support")
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ set (XGETTEXT_OPTIONS
|
|||||||
--from-code=utf-8
|
--from-code=utf-8
|
||||||
)
|
)
|
||||||
|
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/translations)
|
||||||
|
|
||||||
macro(add_pot outfiles header pot)
|
macro(add_pot outfiles header pot)
|
||||||
# Make relative filenames for all source files
|
# Make relative filenames for all source files
|
||||||
set(add_pot_sources)
|
set(add_pot_sources)
|
||||||
@@ -64,18 +66,21 @@ macro(add_po outfiles po_prefix)
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND ${outfiles} ${_qm_filepath})
|
list(APPEND ${outfiles} ${_qm_filepath})
|
||||||
|
list(APPEND INSTALL_TRANSLATIONS_FILES ${_qm_filepath})
|
||||||
endforeach (_lang)
|
endforeach (_lang)
|
||||||
|
|
||||||
# Generate a qrc file for the translations
|
# Generate a qrc file for the translations
|
||||||
set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
|
if(NOT INSTALL_TRANSLATIONS)
|
||||||
file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
|
set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
|
||||||
foreach(_lang ${ADD_PO_LANGUAGES})
|
file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
|
||||||
file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
|
foreach(_lang ${ADD_PO_LANGUAGES})
|
||||||
endforeach(_lang)
|
file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
|
||||||
file(APPEND ${_qrc} "</qresource></RCC>")
|
endforeach(_lang)
|
||||||
if(WITH_QT6)
|
file(APPEND ${_qrc} "</qresource></RCC>")
|
||||||
qt6_add_resources(${outfiles} ${_qrc})
|
if(WITH_QT6)
|
||||||
else()
|
qt6_add_resources(${outfiles} ${_qrc})
|
||||||
qt5_add_resources(${outfiles} ${_qrc})
|
else()
|
||||||
|
qt5_add_resources(${outfiles} ${_qrc})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro(add_po)
|
endmacro(add_po)
|
||||||
|
|||||||
@@ -1243,6 +1243,10 @@ if(NOT APPLE)
|
|||||||
install(TARGETS strawberry RUNTIME DESTINATION bin)
|
install(TARGETS strawberry RUNTIME DESTINATION bin)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(INSTALL_TRANSLATIONS_FILES)
|
||||||
|
install(FILES ${INSTALL_TRANSLATIONS_FILES} DESTINATION share/translations)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/Info.plist")
|
set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/Info.plist")
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|||||||
@@ -58,9 +58,10 @@
|
|||||||
#cmakedefine HAVE_TAGLIB_DSDIFFFILE
|
#cmakedefine HAVE_TAGLIB_DSDIFFFILE
|
||||||
|
|
||||||
#cmakedefine USE_BUNDLE
|
#cmakedefine USE_BUNDLE
|
||||||
|
|
||||||
#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}"
|
#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}"
|
||||||
|
|
||||||
#cmakedefine HAVE_TRANSLATIONS
|
#cmakedefine HAVE_TRANSLATIONS
|
||||||
|
#cmakedefine INSTALL_TRANSLATIONS
|
||||||
|
#define TRANSLATIONS_DIR "${CMAKE_INSTALL_PREFIX}/share/translations"
|
||||||
|
|
||||||
#endif // CONFIG_H_IN
|
#endif // CONFIG_H_IN
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ int main(int argc, char* argv[]) {
|
|||||||
// Resources
|
// Resources
|
||||||
Q_INIT_RESOURCE(data);
|
Q_INIT_RESOURCE(data);
|
||||||
Q_INIT_RESOURCE(icons);
|
Q_INIT_RESOURCE(icons);
|
||||||
#ifdef HAVE_TRANSLATIONS
|
#if defined(HAVE_TRANSLATIONS) && !defined(INSTALL_TRANSLATIONS)
|
||||||
Q_INIT_RESOURCE(translations);
|
Q_INIT_RESOURCE(translations);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -254,6 +254,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
translations->LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
|
translations->LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
|
||||||
translations->LoadTranslation("strawberry", ":/translations", language);
|
translations->LoadTranslation("strawberry", ":/translations", language);
|
||||||
|
translations->LoadTranslation("strawberry", TRANSLATIONS_DIR, language);
|
||||||
translations->LoadTranslation("strawberry", a.applicationDirPath(), language);
|
translations->LoadTranslation("strawberry", a.applicationDirPath(), language);
|
||||||
translations->LoadTranslation("strawberry", QDir::currentPath(), language);
|
translations->LoadTranslation("strawberry", QDir::currentPath(), language);
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/mainwindow.h"
|
#include "core/mainwindow.h"
|
||||||
@@ -73,8 +74,12 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog) : SettingsP
|
|||||||
|
|
||||||
#ifdef HAVE_TRANSLATIONS
|
#ifdef HAVE_TRANSLATIONS
|
||||||
// Populate the language combo box. We do this by looking at all the compiled in translations.
|
// Populate the language combo box. We do this by looking at all the compiled in translations.
|
||||||
QDir dir(":/translations/");
|
QDir dir1(":/translations/");
|
||||||
QStringList codes(dir.entryList(QStringList() << "*.qm"));
|
QDir dir2(TRANSLATIONS_DIR);
|
||||||
|
QStringList codes(dir1.entryList(QStringList() << "*.qm"));
|
||||||
|
if (dir2.exists()) {
|
||||||
|
codes << dir2.entryList(QStringList() << "*.qm");
|
||||||
|
}
|
||||||
QRegularExpression lang_re("^strawberry_(.*).qm$");
|
QRegularExpression lang_re("^strawberry_(.*).qm$");
|
||||||
for (const QString &filename : codes) {
|
for (const QString &filename : codes) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user