]> git.pld-linux.org Git - packages/clementine.git/blame - unbundle-po.patch
- libcdio related rebuild
[packages/clementine.git] / unbundle-po.patch
CommitLineData
a127fee1
ER
1Do not bundle translations with a binary,
2package them to system dir and use %lang tagging in package.
3
4some paths debug:
5 qWarning() << "language: " << language;
6 qWarning() << "qtpath: " << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
7 qWarning() << "apppath: " << a.applicationDirPath();
8 qWarning() << "curdir: " << QDir::currentPath();
9
10TODO: add install target
11TODO: make it configurable via cmake params.
12
13Author: Elan Ruusamäe <glen@pld-linux.org>
14
15--- clementine-0.5.3/src/main.cpp~ 2010-10-18 23:59:12.000000000 +0300
16+++ clementine-0.5.3/src/main.cpp 2010-10-18 23:59:15.876170584 +0300
17@@ -176,7 +176,7 @@
18
19 // Resources
20 Q_INIT_RESOURCE(data);
21- Q_INIT_RESOURCE(translations);
22+ //Q_INIT_RESOURCE(translations);
23
24 // Has the user forced a different language?
25 QString language = options.language();
26@@ -187,9 +187,15 @@
27 }
28
29 // Translations
30+ // Qt: system path
31 LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
32+ // Clementine: system path
33+ LoadTranslation("clementine", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
34+ // Clementine: QRC
35 LoadTranslation("clementine", ":/translations", language);
36+ // Clementine: application path
37 LoadTranslation("clementine", a.applicationDirPath(), language);
38+ // Clementine: current dir
39 LoadTranslation("clementine", QDir::currentPath(), language);
40
41 // Icons
1aea93ea
ER
42--- clementine-1.2.1/src/ui/behavioursettingspage.cpp~ 2014-01-12 14:32:52.000000000 +0200
43+++ clementine-1.2.1/src/ui/behavioursettingspage.cpp 2014-01-12 14:40:18.083783760 +0200
e0ba0da9
JP
44@@ -21,6 +21,7 @@
45 #include "playlist/playlist.h"
46
47 #include <QDir>
48+#include <QLibraryInfo>
49
50
51 BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
1aea93ea
ER
52@@ -51,17 +51,15 @@
53 ui_->menu_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
54 ui_->menu_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
9400a97a 55
1aea93ea
ER
56- // Populate the language combo box. We do this by looking at all the
57- // compiled in translations.
9400a97a
ER
58- QDir dir(":/translations/");
59- QStringList codes(dir.entryList(QStringList() << "*.qm"));
60- QRegExp lang_re("^clementine_(.*).qm$");
61- foreach (const QString& filename, codes) {
62- // The regex captures the "ru" from "clementine_ru.qm"
63- if (!lang_re.exactMatch(filename))
1aea93ea
ER
64- continue;
65+ // Populate the language combo box
66+ // We do this by looking at all the compiled in translations.
8130efd6 67+ QDir localeDir(QLibraryInfo::location(QLibraryInfo::TranslationsPath));
9400a97a
ER
68+ QStringList dirList = localeDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
69+ foreach (const QString& code, dirList) {
8130efd6 70+ if (!QFile::exists(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + code + "/LC_MESSAGES/clementine.qm")) {
1aea93ea 71+ continue;
9400a97a
ER
72+ }
73
74- QString code = lang_re.cap(1);
1aea93ea
ER
75 QString language_name = QLocale::languageToString(QLocale(code).language());
76 #if QT_VERSION >= 0x040800
77 QString native_name = QLocale(code).nativeLanguageName();
0016e833
ER
78--- clementine-0.5.3/cmake/Translations.cmake 2010-10-18 23:59:53.487509786 +0300
79+++ clementine-0.5.3/cmake/Translations.cmake 2010-10-19 01:42:52.112825900 +0300
80@@ -65,10 +65,22 @@
a127fee1
ER
81
82- # Generate a qrc file for the translations
83- set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
84- file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
85- foreach(_lang ${ADD_PO_LANGUAGES})
86- file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
87- endforeach(_lang)
88- file(APPEND ${_qrc} "</qresource></RCC>")
89- qt4_add_resources(${outfiles} ${_qrc})
0016e833
ER
90+ # install .qm
91+ set(_potBasename "clementine")
92+ foreach (_lang ${ADD_PO_LANGUAGES})
93+ set(_qm_filename "clementine_${_lang}.qm")
94+ set(_qm_filepath "${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/${_qm_filename}")
95+
96+ install(FILES ${_qm_filepath} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.qm)
97+ set(_gmoFiles ${_gmoFiles} ${_gmoFile})
98+ endforeach (_lang)
99+
100+ add_custom_target(translations ALL DEPENDS ${_gmoFiles})
101+
a127fee1
ER
102+# # Generate a qrc file for the translations
103+# set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
104+# file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
105+# foreach(_lang ${ADD_PO_LANGUAGES})
106+# file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
107+# endforeach(_lang)
108+# file(APPEND ${_qrc} "</qresource></RCC>")
109+# qt4_add_resources(${outfiles} ${_qrc})
110 endmacro(add_po)
63e5b363
ER
111--- clementine-1.1.1/tests/resources_env.h~ 2013-09-08 01:29:59.000000000 +0300
112+++ clementine-1.1.1/tests/resources_env.h 2013-09-08 01:30:00.886424405 +0300
113@@ -26,7 +26,7 @@
114 public:
115 void SetUp() {
116 Q_INIT_RESOURCE(data);
117- Q_INIT_RESOURCE(translations);
118+// Q_INIT_RESOURCE(translations);
119 Q_INIT_RESOURCE(testdata);
120 }
121 };
122--- clementine-1.1.1/tests/translations_test.cpp~ 2013-09-08 01:34:17.000000000 +0300
123+++ clementine-1.1.1/tests/translations_test.cpp 2013-09-08 01:34:21.084475375 +0300
124@@ -23,14 +23,14 @@
125 #include "test_utils.h"
126
127 TEST(Translations, Basic) {
128- ASSERT_TRUE(QFile::exists(":/translations"));
129- ASSERT_TRUE(QFile::exists(":/translations/clementine_es.qm"));
130+// ASSERT_TRUE(QFile::exists(":/translations"));
131+// ASSERT_TRUE(QFile::exists(":/translations/clementine_es.qm"));
132
133 PoTranslator t;
134 t.load("clementine_es.qm", ":/translations");
135
136- EXPECT_EQ(QString::fromUtf8("Colección"),
137- t.translate("MainWindow", "Library"));
138- EXPECT_EQ(QString::fromUtf8("Colección"),
139- t.translate("", "Library"));
140+// EXPECT_EQ(QString::fromUtf8("Colección"),
141+// t.translate("MainWindow", "Library"));
142+// EXPECT_EQ(QString::fromUtf8("Colección"),
143+// t.translate("", "Library"));
144 }
This page took 0.17369 seconds and 4 git commands to generate.