]> git.pld-linux.org Git - packages/clementine.git/blame - unbundle-po.patch
- up to 1.0.1
[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
e0ba0da9
JP
42--- clementine-0.5.3/src/ui/behavioursettingspage.cpp~ 2010-10-19 11:24:36.488320486 +0300
43+++ clementine-0.5.3/src/ui/behavioursettingspage.cpp 2010-10-19 11:24:40.594127569 +0300
44@@ -21,6 +21,7 @@
45 #include "playlist/playlist.h"
46
47 #include <QDir>
48+#include <QLibraryInfo>
49
50
51 BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
9400a97a
ER
52@@ -93,15 +93,22 @@
53
54 // Populate the language combo box. We do this by looking at all the
55 // compiled in translations.
56- QDir dir(":/translations/");
57- QStringList codes(dir.entryList(QStringList() << "*.qm"));
58- QRegExp lang_re("^clementine_(.*).qm$");
59- foreach (const QString& filename, codes) {
60- // The regex captures the "ru" from "clementine_ru.qm"
61- if (!lang_re.exactMatch(filename))
62+// QDir dir(":/translations/");
8130efd6 63+ QDir localeDir(QLibraryInfo::location(QLibraryInfo::TranslationsPath));
9400a97a
ER
64+ QStringList dirList = localeDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
65+ foreach (const QString& code, dirList) {
8130efd6 66+ if (!QFile::exists(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + code + "/LC_MESSAGES/clementine.qm")) {
9400a97a
ER
67 continue;
68+ }
69
70- QString code = lang_re.cap(1);
71+// QStringList codes(dir.entryList(QStringList() << "*.qm"));
72+// QRegExp lang_re("^clementine_(.*).qm$");
73+// foreach (const QString& filename, codes) {
74+// // The regex captures the "ru" from "clementine_ru.qm"
75+// if (!lang_re.exactMatch(filename))
76+// continue;
77+
78+// QString code = lang_re.cap(1);
79 QString name = QString("%1 (%2)").arg(
80 QLocale::languageToString(QLocale(code).language()), code);
81
0016e833
ER
82--- clementine-0.5.3/cmake/Translations.cmake 2010-10-18 23:59:53.487509786 +0300
83+++ clementine-0.5.3/cmake/Translations.cmake 2010-10-19 01:42:52.112825900 +0300
84@@ -65,10 +65,22 @@
a127fee1
ER
85
86- # Generate a qrc file for the translations
87- set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
88- file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
89- foreach(_lang ${ADD_PO_LANGUAGES})
90- file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
91- endforeach(_lang)
92- file(APPEND ${_qrc} "</qresource></RCC>")
93- qt4_add_resources(${outfiles} ${_qrc})
0016e833
ER
94+ # install .qm
95+ set(_potBasename "clementine")
96+ foreach (_lang ${ADD_PO_LANGUAGES})
97+ set(_qm_filename "clementine_${_lang}.qm")
98+ set(_qm_filepath "${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/${_qm_filename}")
99+
100+ install(FILES ${_qm_filepath} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.qm)
101+ set(_gmoFiles ${_gmoFiles} ${_gmoFile})
102+ endforeach (_lang)
103+
104+ add_custom_target(translations ALL DEPENDS ${_gmoFiles})
105+
a127fee1
ER
106+# # Generate a qrc file for the translations
107+# set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/${ADD_PO_DIRECTORY}/translations.qrc)
108+# file(WRITE ${_qrc} "<RCC><qresource prefix=\"/${ADD_PO_DIRECTORY}\">")
109+# foreach(_lang ${ADD_PO_LANGUAGES})
110+# file(APPEND ${_qrc} "<file>${po_prefix}${_lang}.qm</file>")
111+# endforeach(_lang)
112+# file(APPEND ${_qrc} "</qresource></RCC>")
113+# qt4_add_resources(${outfiles} ${_qrc})
114 endmacro(add_po)
This page took 0.087708 seconds and 4 git commands to generate.