Skip to content

Commit 1ff42b2

Browse files
committed
Merge pull request #284 from slarosa/master
improvement for detection language in console_help
2 parents 552703a + 3c50290 commit 1ff42b2

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

python/console_help.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ def setupUi(self):
5555
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
5656
self.verticalLayout.addLayout(self.horizontalLayout)
5757
self.setLayout(self.verticalLayout)
58-
jQueryPath = QgsApplication.pkgDataPath()
58+
qgisDataDir = QgsApplication.pkgDataPath()
59+
listFile = os.listdir(qgisDataDir + "/python/console_help/i18n")
5960
localeFullName = QSettings().value( "locale/userLocale", QVariant( "" ) ).toString()
60-
filename = QgsApplication.pkgDataPath() + "/python/console_help/help.htm? \
61-
lang=" + localeFullName \
62-
+ "&pkgDir=" + jQueryPath
61+
for i in listFile:
62+
lang = i[0:5]
63+
if localeFullName in (lang[0:2], lang):
64+
locale = lang
65+
66+
filename = qgisDataDir + "/python/console_help/help.htm? \
67+
lang=" + locale \
68+
+ "&pkgDir=" + qgisDataDir
6369

6470
url = QtCore.QUrl(filename)
6571
self.webView.load(url)

python/console_help/help.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ <h4 id="thanks">Acknowledgments</h4>
147147
var locale = langPathParameters[0].split("=");
148148
var jQueryPath = langPathParameters[1].split("=");
149149
var pathJs = jQueryPath[1];
150-
var lang = locale[1].split("_")[0];
150+
var lang = locale[1];
151151
var jquery = document.createElement("script");
152152
jquery.type = "text/javascript";
153153
jquery.src = pathJs + "/resources/jQuery/jquery-1.8.2.min.js";

python/console_help/i18n/README

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
You can contribute at translate this help by creating an file *.properties named like
2-
*.ts files (only the locale suffix) which found in Quantum-GIS\i18n directory.
3-
For example: for Italian translation copy and paste a *.properties file and rename it to "it.properties".
1+
You can contribute at translate this help by creating an file *.properties and name it in
2+
<your_locale_name>.properties
3+
To get your locale name type the following lines in console:
4+
5+
>>> from PyQt4.QtCore import *
6+
>>> QLocale.system().name()
7+
8+
For example: for Italian translation copy and paste a *.properties file and rename it to "it_IT.properties".
49
The only thing what you have to do is translate the values of the keys in dictionary.
510

611
i18n_dict = {

0 commit comments

Comments
 (0)