Skip to content
Permalink
Browse files

Added i18n for help (Python Console)

  • Loading branch information
slarosa committed Sep 30, 2012
1 parent 32deee7 commit 4b604f194edc9b984850ddba0304c122fa3049ac
@@ -6253,6 +6253,10 @@ Cambiare questa situazione prima, perché il plugin OSM non quale layer è la de
<source>Python Console</source>
<translation>Console python</translation>
</message>
<message>
<source>Help Python Console</source>
<translation>Aiuto Console Python</translation>
</message>
<message>
<source>Import Class</source>
<translation>Importa Modulo</translation>
@@ -13,7 +13,7 @@ def __init__(self):
def setupUi(self):
self.setMaximumSize(500, 300)
self.webView = QtWebKit.QWebView()
self.setWindowTitle("Help Python Console")
self.setWindowTitle(QCoreApplication.translate("PythonConsole","Help Python Console"))
self.verticalLayout= QtGui.QVBoxLayout()
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
@@ -29,7 +29,8 @@ def setupUi(self):
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
self.verticalLayout.addLayout(self.horizontalLayout)
self.setLayout(self.verticalLayout)
filename = os.path.dirname(__file__) + "/helpConsole/help.htm"
localeFullName = QSettings().value( "locale/userLocale", QVariant( "" ) ).toString()
filename = os.path.dirname(__file__) + "/helpConsole/help.htm?lang=" + localeFullName
url = QtCore.QUrl(filename)
self.webView.load(url)

@@ -1,2 +1,7 @@
FILE(GLOB HTML_FILES *.htm)
FILE(GLOB I18N_FILES i18n/*.properties)
FILE(GLOB JS_FILES js/*.js)

INSTALL(FILES ${HTML_FILES} DESTINATION ${QGIS_PYTHON_DIR}/helpConsole)
INSTALL(FILES ${I18N_FILES} DESTINATION ${QGIS_PYTHON_DIR}/helpConsole/i18n)
INSTALL(FILES ${JS_FILES} DESTINATION ${QGIS_PYTHON_DIR}/helpConsole/js)
@@ -2,6 +2,26 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Help Python Console</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/jquery.i18n.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var parameter = window.location.search.replace( "?", "" );
var locale = parameter.split("=");
var lang = locale[1]
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "i18n/" + lang + ".properties";
document.body.appendChild(js);
//alert(js.src);

var encode = document.createElement("script");
encode.type = "text/javascript";
encode.src = "js/encoding.js";
document.body.appendChild(encode);
});
</script>
<style>
body{
font-family: verdana,arial,helvetica,sans-serif;
@@ -25,28 +45,28 @@
<img src="../iconConsole/imgHelpDialog.png" />
</td>
<td>
<h2>Python Console for QGIS</h2>
<h2 id="headerTitle">Python Console for QGIS</h2>
</td>
</tr>
</table>
<p align="justify">
Python Console based on pyScintilla. (Developed by Salvatore Larosa)
<span id="headerSubject">Python Console based on PyQScintilla2. (Developed by Salvatore Larosa)</span>
<br><br>
To access Quantum GIS environment from this console
<span id="headerSubjectMain">To access Quantum GIS environment from this console
use qgis.utils.iface object (instance of QgisInterface class).
To import the class QgisInterface can also use the dedicated
button on the toolbar on the left.
button on the toolbar on the left.</span>
</p>
<table id="header">
<tr>
<td>
<h4>Features</h4>
<h4 id="features">Features</h4>
</td>
</tr>
</table>
<p align="justify">
<ul>
<li>Auto-completion and highlighting syntax for the following APIs:
<li><span id="featuresTitle">Auto-completion and highlighting syntax for the following APIs:</span>
<ol>
<li>Python</li>
<li>PyQGIS-master</li>
@@ -56,75 +76,75 @@ <h4>Features</h4>
</ol>
</li>
<br>
<li>CTRL+SPACE to view the auto-completion list.</li>
<li><span id="featuresA">CTRL+SPACE to view the auto-completion list.</span></li>
<br>
<li>CTRL+ALT+SPACE to view the command history list.</li>
<li><span id="featuresB">CTRL+ALT+SPACE to view the command history list.</span></li>
<br>
<li>Saves the command history by typing <b>_save</b> or closing the widget.<br>
This command saves the history command in the file ~/.qgis/console_history.txt
<li><span id="featuresC">Saves the command history by typing <b>_save</b> or closing the widget.<br>
This command saves the history command in the file ~/.qgis/console_history.txt</span>
</li>
<br>
<li>Clears the command history by typing <b>_clear</b>.<br>
This command clears the command history from file ~/.qgis/console_history.txt
<li><span id="featuresD">Clears the command history by typing <b>_clear</b>.<br>
This command clears the command history from file ~/.qgis/console_history.txt</span>
</li>
<br>
<li>Clears completely command history by typing <b>_clearAll</b>.<br>
This command clears completely the command history. It has an irreversible effect.
<li><span id="featuresE">Clears completely command history by typing <b>_clearAll</b>.<br>
This command clears completely the command history. It has an irreversible effect.</span>
</li>
</ul>
</p>
<table id="header">
<tr>
<td>
<h4>Toolbar</h4>
<h4 id="toolbar">Toolbar</h4>
</td>
</tr>
</table>
<p>The following is a description of the tools in the toolbar:</p>
<p><span id="toolbarTitle">The following is a description of the tools in the toolbar:</span></p>
<table width="100%" border="0" id="headerTool">
<tr>
<td><img src="../iconConsole/iconClearConsole.png" /></td>
<td colspan="2">Tool to clear python console</td>
<td colspan="2"><span id="toolbarClear">Tool to clear python console</span></td>
</tr>
<tr>
<td><img src="../iconConsole/iconClassConsole.png" /></td>
<td><img src="../iconConsole/iconIfaceConsole.png" /></td>
<td>Tool to import iface class</td>
<td><span id="toolbarIfaceClass">Tool to import iface class</span></td>
</tr>
<tr>
<td></td>
<td><img src="../iconConsole/iconSextanteConsole.png" /></td>
<td>Tool to import Sextante class</td>
<td><span id="toolbarSextClass">Tool to import Sextante class</span></td>
</tr>
<tr>
<td><img src="../iconConsole/iconScriptConsole.png" /></td>
<td><img src="../iconConsole/iconOpenConsole.png" /></td>
<td>Tool to open a python script and load in console</td>
<td><span id="toolbarScriptOpen">Tool to open a python script and load in console</span></td>
</tr>
<tr>
<td></td>
<td><img src="../iconConsole/iconSaveConsole.png" /></td>
<td>Tool to save a python script</td>
<td><span id="toolbarScriptSave">Tool to save a python script</span></td>
</tr>
<tr>
<td><img src="../iconConsole/iconHelpConsole.png" /></td>
<td colspan="2">Help</td>
<td colspan="2"><span id="toolbarHelp">Help</span></td>
</tr>
<tr>
<td><img src="../iconConsole/iconRunConsole.png" /></td>
<td colspan="2">Run command (like Enter key pressed)</td>
<td colspan="2"><span id="toolbarRun">Run command (like Enter key pressed)</span></td>
</tr>
</table>
<br>
<table id="header">
<tr>
<td>
<h4>Acknowledgments</h4>
<h4 id="thanks">Acknowledgments</h4>
</td>
</tr>
</table>
<p>
Thanks to Larry Shaffer who provided the API files.
<span id="thanksText">Thanks to Larry Shaffer who provided the API files.</span>
</p>
</body>
</html>
@@ -0,0 +1,8 @@
You can contribute at translate this help by creating an file *.properties named like
*.ts files (only the locale suffix) which found in Quantum-GIS\i18n directory.
For example: for Italian translation copy and paste a *.properties file and rename it to "it.js".
The only thing what you have to do is translate the values of the keys in dictionary.

i18n_dict = {
"key" : "value"
}
@@ -0,0 +1,29 @@
i18n_dict = {
"header.title" : "Python Console for QGIS",
"header.subject" : "Python Console based on PyQScintilla2. (Developed by Salvatore Larosa)",
"header.subject.main" : "To access Quantum GIS environment from this console \
use qgis.utils.iface object (instance of QgisInterface class). \
To import the class QgisInterface can also use the dedicated \
button on the toolbar on the left.",
"features" : "Features",
"features.title" : "Auto-completion and highlighting syntax for the following APIs:",
"features.a" : "CTRL+SPACE to view the auto-completion list.",
"features.b" : "CTRL+ALT+SPACE to view the command history list.",
"features.c" : "Saves the command history by typing '_save' or closing the widget. \
This command saves the history command in the file ~/.qgis/console_history.txt",
"features.d" : "Clears the command history by typing '_clear'. \
This command clears the command history from file ~/.qgis/console_history.txt",
"features.e" : "Clears completely command history by typing '_clearAll'. \
This command clears completely the command history. It has an irreversible effect.",
"toolbar" : "Toolbar",
"toolbar.title" : "The following is a description of the tools in the toolbar:",
"toolbar.clear" : "Tool to clear python console",
"toolbar.iface" : "Tool to import iface class",
"toolbar.sextante" : "Tool to import Sextante class",
"toolbar.script.open" : "Tool to open a python script and load in console",
"toolbar.script.save" : "Tool to save a python script",
"toolbar.help" : "Help",
"toolbar.run" : "Run command (like Enter key pressed)",
"thanks" : "Acknowledgments",
"thanks.text" : "Thanks to Larry Shaffer who provided the API files."
};
@@ -0,0 +1,29 @@
i18n_dict = {
"header.title" : "Console Python per QGIS",
"header.subject" : "Console Python basata su PyQScintilla2. (Sviluppata da Salvatore Larosa)",
"header.subject.main" : "Per accedere all'ambiente Quantum GIS da questa console \
usa l'oggetto qgis.utils.iface (istanza della classe QgisInterface). \
Per importare la classe QgisInterface puoi usare anche il bottone dedicato che si trova \
sulla toolbar.",
"features" : "Funzionalità",
"features.title" : "Completamento automatico ed evidenziazione della sintassi per le seguenti APIs:",
"features.a" : "CTRL+SPACE per visualizzare la lista per l'autocompletamento di classi e metodi.",
"features.b" : "CTRL+ALT+SPACE per visualizzare la lista della cronologia dei comandi.",
"features.c" : "Possibilità di salvare la cronologia dei comandi digitando '_save' o semplicemente chiudendo il widget. \
La cronologia verrà salvata all'interno del file ~/.qgis/console_history.txt",
"features.d" : "Possibilità di cancellare la storia dei comandi digitando '_clear'. \
La cronologia verrà cancellata dal file ~/.qgis/console_history.txt",
"features.e" : "Possibilità di cancellare completamente la cronologia dei comandi digitando '_clearAll'. \
La cronologia verrà cancellata sia dal file che dalla memoria temporanea.",
"toolbar" : "Toolbar",
"toolbar.title" : "Di seguito la descrizione dei comandi disponibile nella toolbar:",
"toolbar.clear" : "Strumento per pulire la console",
"toolbar.iface" : "Strumento per importare la classe iface, per accedere all'ambiente QGIS",
"toolbar.sextante" : "Strumento per importare la classe Sextante",
"toolbar.script.open" : "Strumento per aprire un script python da eseguire in console",
"toolbar.script.save" : "Strumento per salvare uno script python sul disco",
"toolbar.help" : "Aiuto",
"toolbar.run" : "Esegui comando (simile al tasto <Invio>)",
"thanks" : "Ringraziamenti",
"thanks.text" : "Grazie a Larry Shaffer per aver fornito i file con le API."
};
@@ -0,0 +1,23 @@
$.i18n.setDictionary(i18n_dict);

$('h2#headerTitle').text($.i18n._('header.title'));
$('span#headerSubject').text($.i18n._('header.subject'));
$('span#headerSubjectMain').text($.i18n._('header.subject.main'));
$('h4#features').text($.i18n._('features'));
$('span#featuresTitle').text($.i18n._('features.title'));
$('span#featuresA').text($.i18n._('features.a'));
$('span#featuresB').text($.i18n._('features.b'));
$('span#featuresC').text($.i18n._('features.c'));
$('span#featuresD').text($.i18n._('features.d'));
$('span#featuresE').text($.i18n._('features.e'));
$('h4#toolbar').text($.i18n._('toolbar'));
$('span#toolbarTitle').text($.i18n._('toolbar.title'));
$('span#toolbarClear').text($.i18n._('toolbar.clear'));
$('span#toolbarIfaceClass').text($.i18n._('toolbar.iface'));
$('span#toolbarSextClass').text($.i18n._('toolbar.sextante'));
$('span#toolbarScriptOpen').text($.i18n._('toolbar.script.open'));
$('span#toolbarScriptSave').text($.i18n._('toolbar.script.save'));
$('span#toolbarHelp').text($.i18n._('toolbar.help'));
$('span#toolbarRun').text($.i18n._('toolbar.run'));
$('h4#thanks').text($.i18n._('thanks'));
$('span#thanksText').text($.i18n._('thanks.text'));

Large diffs are not rendered by default.

@@ -0,0 +1,13 @@
/*
* jQuery i18n plugin
* @requires jQuery v1.1 or later
*
* See http://recursive-design.com/projects/jquery-i18n/
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Version: 0.9.2 (201204070102)
*/
(function(f){f.i18n={dict:null,setDictionary:function(a){this.dict=a},_:function(a,b){var d=a;if(this.dict&&this.dict[a])d=this.dict[a];return this.printf(d,b)},toEntity:function(a){for(var b="",d=0;d<a.length;d++)b+=a.charCodeAt(d)>128?"&#"+a.charCodeAt(d)+";":a.charAt(d);return b},stripStr:function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")},stripStrML:function(a){a=a.split("\n");for(var b=0;b<a.length;b++)a[b]=stripStr(a[b]);return stripStr(a.join(" "))},printf:function(a,b){if(!b)return a;
for(var d="",e=/%(\d+)\$s/g;result=e.exec(a);){var c=parseInt(result[1],10)-1;a=a.replace("%"+result[1]+"$s",b[c]);b.splice(c,1)}e=a.split("%s");if(e.length>1)for(c=0;c<b.length;c++){if(e[c].lastIndexOf("%")==e[c].length-1&&c!=b.length-1)e[c]+="s"+e.splice(c+1,1)[0];d+=e[c]+b[c]}return d+e[e.length-1]}};f.fn._t=function(a,b){return f(this).text(f.i18n._(a,b))}})(jQuery);

0 comments on commit 4b604f1

Please sign in to comment.
You can’t perform that action at this time.