update grass i18n

git-svn-id: http://svn.osgeo.org/qgis/trunk@12660 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2010-01-01 02:29:28 +00:00
parent a276b50e6b
commit 4785ba5c30
2 changed files with 13 additions and 5 deletions

View File

@ -43,6 +43,7 @@
extern "C" extern "C"
{ {
#include <grass/Vect.h> #include <grass/Vect.h>
#include <grass/glocale.h>
} }
#include <gdal.h> // to collect version information #include <gdal.h> // to collect version information
@ -941,7 +942,7 @@ QString QgsGrassModule::label( QString path )
qFile.close(); qFile.close();
QDomElement qDocElem = qDoc.documentElement(); QDomElement qDocElem = qDoc.documentElement();
return QApplication::translate( "grasslabel", qDocElem.attribute( "label" ).toUtf8() ); return QApplication::translate( "grasslabel", qDocElem.attribute( "label" ).trimmed().toUtf8() );
} }
QPixmap QgsGrassModule::pixmap( QString path, int height ) QPixmap QgsGrassModule::pixmap( QString path, int height )
@ -1491,6 +1492,11 @@ QgsGrassModule::~QgsGrassModule()
} }
} }
QString QgsGrassModule::translate( QString msg )
{
return QString::fromUtf8( G_gettext( "grassmods", msg.trimmed().toUtf8() ) );
}
QDomNode QgsGrassModule::nodeByKey( QDomElement elem, QString key ) QDomNode QgsGrassModule::nodeByKey( QDomElement elem, QString key )
{ {
QgsDebugMsg( "called with key=" + key ); QgsDebugMsg( "called with key=" + key );
@ -2503,7 +2509,7 @@ QgsGrassModuleItem::QgsGrassModuleItem( QgsGrassModule *module, QString key,
QString label, description; QString label, description;
if ( !qdesc.attribute( "label" ).isEmpty() ) if ( !qdesc.attribute( "label" ).isEmpty() )
{ {
label = QApplication::translate( "grasslabel", qdesc.attribute( "label" ).toUtf8() ); label = QApplication::translate( "grasslabel", qdesc.attribute( "label" ).trimmed().toUtf8() );
} }
if ( label.isEmpty() ) if ( label.isEmpty() )
{ {
@ -2511,14 +2517,14 @@ QgsGrassModuleItem::QgsGrassModuleItem( QgsGrassModule *module, QString key,
if ( !n.isNull() ) if ( !n.isNull() )
{ {
QDomElement e = n.toElement(); QDomElement e = n.toElement();
label = QApplication::translate( "grasslabel", e.text().toUtf8() ); label = module->translate( e.text() );
} }
} }
QDomNode n = gnode.namedItem( "description" ); QDomNode n = gnode.namedItem( "description" );
if ( !n.isNull() ) if ( !n.isNull() )
{ {
QDomElement e = n.toElement(); QDomElement e = n.toElement();
description = QApplication::translate( "grasslabel", e.text().toUtf8() ); description = module->translate( e.text() );
} }
if ( !label.isEmpty() ) if ( !label.isEmpty() )
@ -2583,7 +2589,7 @@ QgsGrassModuleGdalInput::QgsGrassModuleGdalInput(
{ {
if ( mTitle.isEmpty() ) if ( mTitle.isEmpty() )
{ {
mTitle = "OGR/PostGIS/GDAL Input"; mTitle = tr("OGR/PostGIS/GDAL Input");
} }
adjustTitle(); adjustTitle();

View File

@ -57,6 +57,8 @@ class QgsGrassModule: public QDialog, private Ui::QgsGrassModuleBase
//! Destructor //! Destructor
~QgsGrassModule(); ~QgsGrassModule();
QString translate( QString string );
//! Returns module label for module description path //! Returns module label for module description path
static QString label( QString path ); static QString label( QString path );