]> git.pld-linux.org Git - packages/clementine.git/blame - unbundle-po.patch
update files
[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
ce2dc7f3
ER
15--- clementine-1.3.0rc1/src/main.cpp~ 2016-01-20 17:03:12.000000000 +0200
16+++ clementine-1.3.0rc1/src/main.cpp 2016-01-20 17:04:21.767206898 +0200
a127fee1
ER
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();
ce2dc7f3
ER
26@@ -417,10 +417,15 @@
27 : override_language;
a127fee1
ER
28
29 // Translations
ce2dc7f3
ER
30- LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath),
31- language);
a127fee1 32+ // Qt: system path
ce2dc7f3 33+ LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
a127fee1
ER
34+ // Clementine: system path
35+ LoadTranslation("clementine", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
36+ // Clementine: QRC
37 LoadTranslation("clementine", ":/translations", language);
38+ // Clementine: application path
39 LoadTranslation("clementine", a.applicationDirPath(), language);
40+ // Clementine: current dir
41 LoadTranslation("clementine", QDir::currentPath(), language);
42
ce2dc7f3
ER
43 #ifdef Q_OS_WIN32
44--- clementine-1.3.0rc1/src/ui/behavioursettingspage.cpp~ 2016-01-20 17:03:12.000000000 +0200
45+++ clementine-1.3.0rc1/src/ui/behavioursettingspage.cpp 2016-01-20 17:06:51.358232182 +0200
e0ba0da9
JP
46@@ -21,6 +21,7 @@
47 #include "playlist/playlist.h"
48
49 #include <QDir>
50+#include <QLibraryInfo>
51
52
53 BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
ce2dc7f3
ER
54@@ -60,16 +60,15 @@
55 ui_->menu_previousmode->setItemData(0, Player::PreviousBehaviour_DontRestart);
56 ui_->menu_previousmode->setItemData(1, Player::PreviousBehaviour_Restart);
9400a97a 57
1aea93ea
ER
58- // Populate the language combo box. We do this by looking at all the
59- // compiled in translations.
9400a97a
ER
60- QDir dir(":/translations/");
61- QStringList codes(dir.entryList(QStringList() << "*.qm"));
62- QRegExp lang_re("^clementine_(.*).qm$");
ce2dc7f3 63- for (const QString& filename : codes) {
9400a97a 64- // The regex captures the "ru" from "clementine_ru.qm"
ce2dc7f3 65- if (!lang_re.exactMatch(filename)) continue;
1aea93ea
ER
66+ // Populate the language combo box
67+ // We do this by looking at all the compiled in translations.
8130efd6 68+ QDir localeDir(QLibraryInfo::location(QLibraryInfo::TranslationsPath));
9400a97a
ER
69+ QStringList dirList = localeDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
70+ foreach (const QString& code, dirList) {
8130efd6 71+ if (!QFile::exists(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + code + "/LC_MESSAGES/clementine.qm")) {
1aea93ea 72+ continue;
9400a97a
ER
73+ }
74
75- QString code = lang_re.cap(1);
ce2dc7f3
ER
76 QString lookup_code = QString(code)
77 .replace("@latin", "_Latn")
78 .replace("_CN", "_Hans_CN")
0016e833
ER
79--- clementine-0.5.3/cmake/Translations.cmake 2010-10-18 23:59:53.487509786 +0300
80+++ clementine-0.5.3/cmake/Translations.cmake 2010-10-19 01:42:52.112825900 +0300
81@@ -65,10 +65,22 @@
a127fee1
ER
82
83- # Generate a qrc file for the translations
84- set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
85- file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
86- foreach(_lang ${ADD_PO_LANGUAGES})
87- file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
88- endforeach(_lang)
89- file(APPEND ${_qrc} "</qresource></RCC>")
90- qt4_add_resources(${outfiles} ${_qrc})
0016e833
ER
91+ # install .qm
92+ set(_potBasename "clementine")
93+ foreach (_lang ${ADD_PO_LANGUAGES})
94+ set(_qm_filename "clementine_${_lang}.qm")
95+ set(_qm_filepath "${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/${_qm_filename}")
96+
97+ install(FILES ${_qm_filepath} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.qm)
98+ set(_gmoFiles ${_gmoFiles} ${_gmoFile})
99+ endforeach (_lang)
100+
101+ add_custom_target(translations ALL DEPENDS ${_gmoFiles})
102+
a127fee1
ER
103+# # Generate a qrc file for the translations
104+# set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
105+# file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
106+# foreach(_lang ${ADD_PO_LANGUAGES})
107+# file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
108+# endforeach(_lang)
109+# file(APPEND ${_qrc} "</qresource></RCC>")
110+# qt4_add_resources(${outfiles} ${_qrc})
111 endmacro(add_po)
63e5b363
ER
112--- clementine-1.1.1/tests/resources_env.h~ 2013-09-08 01:29:59.000000000 +0300
113+++ clementine-1.1.1/tests/resources_env.h 2013-09-08 01:30:00.886424405 +0300
114@@ -26,7 +26,7 @@
115 public:
116 void SetUp() {
117 Q_INIT_RESOURCE(data);
118- Q_INIT_RESOURCE(translations);
119+// Q_INIT_RESOURCE(translations);
120 Q_INIT_RESOURCE(testdata);
121 }
122 };
123--- clementine-1.1.1/tests/translations_test.cpp~ 2013-09-08 01:34:17.000000000 +0300
124+++ clementine-1.1.1/tests/translations_test.cpp 2013-09-08 01:34:21.084475375 +0300
125@@ -23,14 +23,14 @@
126 #include "test_utils.h"
127
128 TEST(Translations, Basic) {
129- ASSERT_TRUE(QFile::exists(":/translations"));
130- ASSERT_TRUE(QFile::exists(":/translations/clementine_es.qm"));
131+// ASSERT_TRUE(QFile::exists(":/translations"));
132+// ASSERT_TRUE(QFile::exists(":/translations/clementine_es.qm"));
133
134 PoTranslator t;
135 t.load("clementine_es.qm", ":/translations");
136
137- EXPECT_EQ(QString::fromUtf8("Colección"),
138- t.translate("MainWindow", "Library"));
139- EXPECT_EQ(QString::fromUtf8("Colección"),
140- t.translate("", "Library"));
141+// EXPECT_EQ(QString::fromUtf8("Colección"),
142+// t.translate("MainWindow", "Library"));
143+// EXPECT_EQ(QString::fromUtf8("Colección"),
144+// t.translate("", "Library"));
145 }
This page took 0.107736 seconds and 4 git commands to generate.