mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-14 18:35:16 +01:00
Fix the translation resource file generation - thanks Henry Sylvain. Also add a test to make sure they're always found.
This commit is contained in:
parent
afe2aadcf6
commit
ea1df6dbff
@ -186,7 +186,7 @@ endif (UPDATE_TRANSLATIONS)
|
||||
|
||||
# Generate a qrc file for the translations
|
||||
set(CLEMENTINE-QM-RESOURCE ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
||||
file(WRITE ${CLEMENTINE-QM-RESOURCE} "<RCC><qresource prefix=\"/\">")
|
||||
file(WRITE ${CLEMENTINE-QM-RESOURCE} "<RCC><qresource prefix=\"/translations\">")
|
||||
foreach(QM-FILE ${CLEMENTINE-QM-FILES})
|
||||
file(RELATIVE_PATH QM-RELATIVE-PATH ${CMAKE_CURRENT_BINARY_DIR} ${QM-FILE})
|
||||
file(APPEND ${CLEMENTINE-QM-RESOURCE} "<file>" ${QM-RELATIVE-PATH} "</file>")
|
||||
|
@ -90,3 +90,4 @@ add_test_file(xspfparser_test.cpp false)
|
||||
add_test_file(library_test.cpp false)
|
||||
add_test_file(albumcovermanager_test.cpp true)
|
||||
add_test_file(songplaylistitem_test.cpp false)
|
||||
add_test_file(translations_test.cpp false)
|
||||
|
18
tests/translations_test.cpp
Normal file
18
tests/translations_test.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "test_utils.h"
|
||||
|
||||
TEST(Translations, Basic) {
|
||||
ASSERT_TRUE(QFile::exists(":/translations"));
|
||||
ASSERT_TRUE(QFile::exists(":/translations/clementine_empty.qm"));
|
||||
ASSERT_TRUE(QFile::exists(":/translations/clementine_es.qm"));
|
||||
|
||||
QTranslator t;
|
||||
t.load("clementine_es.qm", ":/translations");
|
||||
|
||||
EXPECT_EQ(QString::fromUtf8("Colección"),
|
||||
t.translate("MainWindow", "Library"));
|
||||
}
|
Loading…
Reference in New Issue
Block a user