Skip to content

11 files changed

+214
-213
lines changed
 

‎src/plugins/grass/modules/v.out.ogr.shape.qgm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<qgisgrassmodule label="Export vector layer to Shapefile" module="v.out.ogr">
55
<option key="input" layeroption="layer" typeoption="type" />
66
<option key="format" answer="ESRI_Shapefile" hidden="yes" />
7+
<flag key="c" answer="on" hidden="no />
78
<file key="dsn" type="new" fileoption="olayer" label="Output Shapefile" filters="Shapefile (*.shp)" />
89
</qgisgrassmodule>

‎src/plugins/grass/qgsgrassattributes.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ int QgsGrassAttributes::addTab ( const QString & label )
162162
tb->setRowReadOnly ( 0, TRUE );
163163
tb->setRowReadOnly ( 1, TRUE );
164164

165-
tb->horizontalHeader()->setLabel( 0, "Column" );
166-
tb->horizontalHeader()->setLabel( 1, "Value" );
167-
tb->horizontalHeader()->setLabel( 2, "Type" ); // Internal use
165+
tb->horizontalHeader()->setLabel( 0, tr("Column") );
166+
tb->horizontalHeader()->setLabel( 1, tr("Value") );
167+
tb->horizontalHeader()->setLabel( 2, tr("Type") ); // Internal use
168168

169169
tb->setLeftMargin(0); // hide row labels
170170

171-
tb->setText ( 0, 0, "Field" );
171+
tb->setText ( 0, 0, tr("Field") );
172172
tb->setText ( 1, 0, "Cat" );
173173

174174
tabCats->addTab ( tb, label );
@@ -310,9 +310,9 @@ void QgsGrassAttributes::updateAttributes ( )
310310

311311
if ( !error->isEmpty() ) {
312312
QMessageBox::warning( 0, tr("Warning"), *error );
313-
resultLabel->setText ( "ERROR" );
313+
resultLabel->setText ( tr("ERROR") );
314314
} else {
315-
resultLabel->setText ( "OK" );
315+
resultLabel->setText ( tr("OK") );
316316
}
317317

318318
delete error;

‎src/plugins/grass/qgsgrassbrowser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ void QgsGrassBrowser::copyMap()
270270
{
271271
suggest = map;
272272
}
273-
QString newName = ed.getItem ( element, "New name",
274-
"New name", suggest, source, &ok );
273+
QString newName = ed.getItem ( element, tr("New name"),
274+
tr("New name"), suggest, source, &ok );
275275

276276
if ( !ok ) return;
277277

@@ -336,8 +336,8 @@ void QgsGrassBrowser::renameMap()
336336

337337
QgsGrassElementDialog ed;
338338
bool ok;
339-
QString newName = ed.getItem ( element, "New name",
340-
"New name", "", map, &ok );
339+
QString newName = ed.getItem ( element, tr("New name"),
340+
tr("New name"), "", map, &ok );
341341

342342
if ( !ok ) return;
343343

‎src/plugins/grass/qgsgrassmapcalc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ QgsGrassMapcalc::QgsGrassMapcalc (
239239
// Add output object
240240
mOutput = new QgsGrassMapcalcObject( QgsGrassMapcalcObject::Output);
241241
mOutput->setId ( nextId() );
242-
mOutput->setValue ( "Output" );
242+
mOutput->setValue ( tr("Output") );
243243
mOutput->setCanvas(mCanvas);
244244
mOutput->setCenter ( (int)(mCanvas->width()-mOutput->width()), (int)(mCanvas->height()/2) ),
245245
mCanvas->update();
@@ -1385,7 +1385,7 @@ void QgsGrassMapcalc::load()
13851385
}
13861386

13871387
case QgsGrassMapcalcObject::Output :
1388-
obj->setValue ( "Output" );
1388+
obj->setValue ( tr("Output") );
13891389
mOutput = obj;
13901390
break;
13911391

‎src/plugins/grass/qgsgrassmodel.cpp

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ QString QgsGrassModelItem::info()
130130
switch ( mType )
131131
{
132132
case QgsGrassModel::Location:
133-
return "Location: " + mLocation;
133+
return QObject::tr("Location: ","Metadata in GRASS Browser") + mLocation;
134134
break;
135135
case QgsGrassModel::Mapset:
136-
return "Location: " + mLocation + "<br>Mapset: " + mMapset;
136+
return QObject::tr("Location: ","Metadata in GRASS Browser") + mLocation + QObject::tr("<br>Mapset: ","Metadata in GRASS Browser") + mMapset;
137137
break;
138138
case QgsGrassModel::Vectors:
139139
case QgsGrassModel::Rasters:
140-
return "Location: " + mLocation + "<br>Mapset: " + mMapset;
140+
return QObject::tr("Location: ") + mLocation + QObject::tr("<br>Mapset: ") + mMapset;
141141
break;
142142
case QgsGrassModel::Raster:
143143
{
144144
QString str = tblStart;
145-
str += htmlTableRow("<b>Raster</b>", "<b>" + mMap + "</b>" );
145+
str += htmlTableRow(QObject::tr("<b>Raster</b>"), "<b>" + mMap + "</b>" );
146146

147147
struct Cell_head head;
148148
int rasterType = -1;
@@ -151,18 +151,18 @@ QString QgsGrassModelItem::info()
151151
if( G_get_cellhd( mMap.toLocal8Bit().data(),
152152
mMapset.toLocal8Bit().data(), &head) != 0 )
153153
{
154-
str += "<tr><td colspan=2>Cannot open raster header</td></tr>";
154+
str += "<tr><td colspan=2>" + QObject::tr("Cannot open raster header") + "</td></tr>";
155155
}
156156
else
157157
{
158-
str += htmlTableRow ( "Rows", QString::number(head.rows));
159-
str += htmlTableRow ( "Columns", QString::number(head.cols) );
160-
str += htmlTableRow ( "N-S resolution", QString::number(head.ns_res) );
161-
str += htmlTableRow ( "E-W resolution", QString::number(head.ew_res) );
162-
str += htmlTableRow ( "North", QString::number(head.north) );
163-
str += htmlTableRow ( "South", QString::number(head.south) );
164-
str += htmlTableRow ( "East", QString::number(head.east) );
165-
str += htmlTableRow ( "West", QString::number(head.west) );
158+
str += htmlTableRow ( QObject::tr("Rows"), QString::number(head.rows));
159+
str += htmlTableRow ( QObject::tr("Columns"), QString::number(head.cols) );
160+
str += htmlTableRow ( QObject::tr("N-S resolution"), QString::number(head.ns_res) );
161+
str += htmlTableRow ( QObject::tr("E-W resolution"), QString::number(head.ew_res) );
162+
str += htmlTableRow ( QObject::tr("North"), QString::number(head.north) );
163+
str += htmlTableRow ( QObject::tr("South"), QString::number(head.south) );
164+
str += htmlTableRow ( QObject::tr("East"), QString::number(head.east) );
165+
str += htmlTableRow ( QObject::tr("West"), QString::number(head.west) );
166166

167167
rasterType = G_raster_map_type( mMap.toLocal8Bit().data(),
168168
mMapset.toLocal8Bit().data() );
@@ -185,7 +185,7 @@ QString QgsGrassModelItem::info()
185185
{
186186
format += "unknown";
187187
}
188-
str += htmlTableRow ( "Format", format );
188+
str += htmlTableRow ( QObject::tr("Format"), format );
189189
}
190190

191191
// Range of values
@@ -196,8 +196,8 @@ QString QgsGrassModelItem::info()
196196
double min, max;
197197
G_get_fp_range_min_max( &range, &min, &max );
198198

199-
str += htmlTableRow ( "Minimum value", QString::number(min));
200-
str += htmlTableRow ( "Maximum value", QString::number(max));
199+
str += htmlTableRow ( QObject::tr("Minimum value"), QString::number(min));
200+
str += htmlTableRow ( QObject::tr("Maximum value"), QString::number(max));
201201
}
202202

203203
// History
@@ -208,12 +208,12 @@ QString QgsGrassModelItem::info()
208208
if ( QString(hist.datsrc_1).length() > 0
209209
|| QString(hist.datsrc_2).length() > 0 )
210210
{
211-
str += htmlTableRow ( "Data source", QString(hist.datsrc_1) + " "
211+
str += htmlTableRow ( QObject::tr("Data source"), QString(hist.datsrc_1) + " "
212212
+ QString(hist.datsrc_2) );
213213
}
214214
if ( QString(hist.keywrd).length() > 0 )
215215
{
216-
str += htmlTableRow ( "Data description", QString(hist.keywrd) );
216+
str += htmlTableRow ( QObject::tr("Data description"), QString(hist.keywrd) );
217217
}
218218
if ( hist.edlinecnt > 0 )
219219
{
@@ -222,7 +222,7 @@ QString QgsGrassModelItem::info()
222222
{
223223
h += QString(hist.edhist[i]) + "<br>";
224224
}
225-
str += htmlTableRow ( "Comments", h);
225+
str += htmlTableRow ( QObject::tr("Comments"), h);
226226
}
227227
}
228228

@@ -237,7 +237,7 @@ QString QgsGrassModelItem::info()
237237
{
238238
if ( Cats.ncats > 0 )
239239
{
240-
str += "<tr><td colspan=2>Categories</td></tr>";
240+
str += "<tr><td colspan=2>" + QObject::tr("Categories") + "</td></tr>";
241241
for ( int i = 0; i < Cats.ncats; i++)
242242
{
243243
str += htmlTableRow (
@@ -257,7 +257,7 @@ QString QgsGrassModelItem::info()
257257
case QgsGrassModel::Vector:
258258
{
259259
QString str = tblStart;
260-
str += htmlTableRow("<b>Vector</b>", "<b>" + mMap + "</b>" );
260+
str += htmlTableRow(QObject::tr("<b>Vector</b>"), "<b>" + mMap + "</b>" );
261261

262262
QgsGrass::setLocation( mGisbase, mLocation );
263263

@@ -270,18 +270,18 @@ QString QgsGrassModelItem::info()
270270
int is3d = Vect_is_3d (&Map);
271271

272272
// Number of elements
273-
str += htmlTableRow ( "Points", QString::number(Vect_get_num_primitives(&Map, GV_POINT)) );
274-
str += htmlTableRow ( "Lines", QString::number(Vect_get_num_primitives(&Map, GV_LINE)) );
275-
str += htmlTableRow ( "Boundaries", QString::number(Vect_get_num_primitives(&Map, GV_BOUNDARY)) );
276-
str += htmlTableRow ( "Centroids", QString::number(Vect_get_num_primitives(&Map, GV_CENTROID)) );
273+
str += htmlTableRow ( QObject::tr("Points"), QString::number(Vect_get_num_primitives(&Map, GV_POINT)) );
274+
str += htmlTableRow ( QObject::tr("Lines"), QString::number(Vect_get_num_primitives(&Map, GV_LINE)) );
275+
str += htmlTableRow ( QObject::tr("Boundaries"), QString::number(Vect_get_num_primitives(&Map, GV_BOUNDARY)) );
276+
str += htmlTableRow ( QObject::tr("Centroids"), QString::number(Vect_get_num_primitives(&Map, GV_CENTROID)) );
277277
if ( is3d )
278278
{
279-
str += htmlTableRow ( "Faces", QString::number( Vect_get_num_primitives(&Map, GV_FACE) ) );
280-
str += htmlTableRow ( "Kernels", QString::number( Vect_get_num_primitives(&Map, GV_KERNEL) ) );
279+
str += htmlTableRow ( QObject::tr("Faces"), QString::number( Vect_get_num_primitives(&Map, GV_FACE) ) );
280+
str += htmlTableRow ( QObject::tr("Kernels"), QString::number( Vect_get_num_primitives(&Map, GV_KERNEL) ) );
281281
}
282282

283-
str += htmlTableRow ( "Areas", QString::number(Vect_get_num_areas(&Map)) );
284-
str += htmlTableRow ( "Islands", QString::number( Vect_get_num_islands(&Map) ) );
283+
str += htmlTableRow ( QObject::tr("Areas"), QString::number(Vect_get_num_areas(&Map)) );
284+
str += htmlTableRow ( QObject::tr("Islands"), QString::number( Vect_get_num_islands(&Map) ) );
285285

286286

287287
// Box and dimension
@@ -296,27 +296,27 @@ QString QgsGrassModelItem::info()
296296
int proj = window.proj;
297297

298298
G_format_northing (box.N, buffer, proj);
299-
str += htmlTableRow ( "North", QString(buffer) );
299+
str += htmlTableRow ( QObject::tr("North"), QString(buffer) );
300300
G_format_northing (box.S, buffer, proj);
301-
str += htmlTableRow ( "South", QString(buffer) );
301+
str += htmlTableRow ( QObject::tr("South"), QString(buffer) );
302302
G_format_easting (box.E, buffer, proj );
303-
str += htmlTableRow ( "East", QString(buffer) );
303+
str += htmlTableRow ( QObject::tr("East"), QString(buffer) );
304304
G_format_easting (box.W, buffer, proj );
305-
str += htmlTableRow ( "West", QString(buffer) );
305+
str += htmlTableRow ( QObject::tr("West"), QString(buffer) );
306306
if ( is3d )
307307
{
308-
str += htmlTableRow ( "Top", QString::number(box.T) );
309-
str += htmlTableRow ( "Bottom", QString::number(box.B) );
308+
str += htmlTableRow ( QObject::tr("Top"), QString::number(box.T) );
309+
str += htmlTableRow ( QObject::tr("Bottom"), QString::number(box.B) );
310310
}
311311

312-
str += htmlTableRow ( "3D", is3d ? "yes" : "no" );
312+
str += htmlTableRow ( "3D", is3d ? QObject::tr("yes") : QObject::tr("no") );
313313

314314
str += "</table>";
315315

316316
// History
317317
Vect_hist_rewind ( &Map );
318318
char hbuffer[1001];
319-
str += "<p>History<br>";
319+
str += "<p>"+ QObject::tr("History<br>");
320320
QRegExp rx ( "^-+$" );
321321
while ( Vect_hist_read ( hbuffer, 1000, &Map ) != NULL ) {
322322
QString row = QString(hbuffer);
@@ -343,8 +343,8 @@ QString QgsGrassModelItem::info()
343343
case QgsGrassModel::VectorLayer:
344344
{
345345
QString str = tblStart;
346-
str += htmlTableRow("<b>Vector</b>", "<b>" + mMap + "</b>" );
347-
str += htmlTableRow("<b>Layer</b>", "<b>" + mLayer + "</b>" );
346+
str += htmlTableRow(QObject::tr("<b>Vector</b>"), "<b>" + mMap + "</b>" );
347+
str += htmlTableRow(QObject::tr("<b>Layer</b>"), "<b>" + mLayer + "</b>" );
348348

349349
QgsGrass::setLocation( mGisbase, mLocation );
350350

@@ -363,7 +363,7 @@ QString QgsGrassModelItem::info()
363363
int type = QgsGrassProvider::grassLayerType(mLayer);
364364
if (type != -1 )
365365
{
366-
str += htmlTableRow("Features",
366+
str += htmlTableRow( QObject::tr("Features"),
367367
QString::number(Vect_cidx_get_type_count(&Map, field, type)) );
368368
}
369369

@@ -372,10 +372,10 @@ QString QgsGrassModelItem::info()
372372
// Database link
373373
if ( fi )
374374
{
375-
str += htmlTableRow("Driver", QString(fi->driver) );
376-
str += htmlTableRow("Database", QString(fi->database) );
377-
str += htmlTableRow("Table", QString(fi->table) );
378-
str += htmlTableRow("Key column", QString(fi->key) );
375+
str += htmlTableRow(QObject::tr("Driver"), QString(fi->driver) );
376+
str += htmlTableRow(QObject::tr("Database"), QString(fi->database) );
377+
str += htmlTableRow(QObject::tr("Table"), QString(fi->table) );
378+
str += htmlTableRow(QObject::tr("Key column"), QString(fi->key) );
379379
}
380380
}
381381
}

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,21 @@ QgsGrassModule::QgsGrassModule ( QgsGrassTools *tools, QString moduleName, QgisI
210210
QString mpath = mPath + ".qgm";
211211
QFile qFile ( mpath );
212212
if ( !qFile.exists() ) {
213-
QMessageBox::warning( 0, "Warning", "The module file (" + mpath + ") not found." );
213+
QMessageBox::warning( 0, tr("Warning"), tr("The module file (") + mpath + tr(") not found.") );
214214
return;
215215
}
216216
if ( ! qFile.open( QIODevice::ReadOnly ) ) {
217-
QMessageBox::warning( 0, "Warning", "Cannot open module file (" + mpath + ")" );
217+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot open module file (") + mpath + tr(")") );
218218
return;
219219
}
220220
QDomDocument qDoc ( "qgisgrassmodule" );
221221
QString err;
222222
int line, column;
223223
if ( !qDoc.setContent( &qFile, &err, &line, &column ) ) {
224-
QString errmsg = "Cannot read module file (" + mpath + "):\n" + err + "\nat line "
224+
QString errmsg = tr("Cannot read module file (") + mpath + tr("):\n") + err + tr("\nat line ")
225225
+ QString::number(line) + " column " + QString::number(column);
226226
std::cerr << errmsg.toLocal8Bit().data() << std::endl;
227-
QMessageBox::warning( 0, "Warning", errmsg );
227+
QMessageBox::warning( 0, tr("Warning"), errmsg );
228228
qFile.close();
229229
return;
230230
}
@@ -250,7 +250,7 @@ QgsGrassModule::QgsGrassModule ( QgsGrassTools *tools, QString moduleName, QgisI
250250
else
251251
{
252252
std::cerr << "Module " << xName.ascii() << " not found" << std::endl;
253-
QMessageBox::warning( 0, "Warning", "Module " + xName + " not found" );
253+
QMessageBox::warning( 0, tr("Warning"), tr("Module ") + xName + tr(" not found") );
254254
return;
255255
}
256256
#else
@@ -293,7 +293,7 @@ QgsGrassModule::QgsGrassModule ( QgsGrassTools *tools, QString moduleName, QgisI
293293
}
294294
else
295295
{
296-
QMessageBox::warning( 0, "Warning", "Cannot find man page " + manPath );
296+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find man page ") + manPath );
297297
}
298298

299299
connect ( &mProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStdout()));
@@ -364,7 +364,7 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions (
364364

365365
if ( arguments.size() == 0 )
366366
{
367-
QMessageBox::warning( 0, "Warning", "Cannot find module "
367+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find module ")
368368
+ mXName );
369369
return;
370370
}
@@ -382,7 +382,7 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions (
382382
|| (process.exitCode() != 0 && process.exitCode() != 255) )
383383
{
384384
std::cerr << "process.exitCode() = " << process.exitCode() << std::endl;
385-
QMessageBox::warning( 0, "Warning", "Cannot start module " + mXName + "<br>"
385+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot start module ") + mXName + "<br>"
386386
+ cmd + " " + arguments.join(" ") + "<br>"
387387
+ QString(process.readAllStandardOutput()) + "<br>"
388388
+ QString(process.readAllStandardError()) );
@@ -395,12 +395,12 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions (
395395
QString err;
396396
int line, column;
397397
if ( !gDoc.setContent( (QByteArray)gDescArray, &err, &line, &column ) ) {
398-
QString errmsg = "Cannot read module description (" + mXName + "):\n" + err + "\nat line "
399-
+ QString::number(line) + " column " + QString::number(column);
398+
QString errmsg = tr("Cannot read module description (") + mXName + tr("):\n") + err + tr("\nat line ")
399+
+ QString::number(line) + tr(" column ") + QString::number(column);
400400
std::cerr << errmsg.toLocal8Bit().data() << std::endl;
401401
std::cerr << QString(gDescArray).local8Bit().data() << std::endl;
402402
std::cerr << QString(errArray).local8Bit().data() << std::endl;
403-
QMessageBox::warning( 0, "Warning", errmsg );
403+
QMessageBox::warning( 0, tr("Warning"), errmsg );
404404
return;
405405
}
406406
QDomElement gDocElem = gDoc.documentElement();
@@ -420,7 +420,7 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions (
420420

421421
QDomNode gnode = QgsGrassModule::nodeByKey ( gDocElem, key );
422422
if ( gnode.isNull() ) {
423-
QMessageBox::warning( 0, "Warning", "Cannot find key " + key );
423+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find key ") + key );
424424
return;
425425
}
426426

@@ -559,7 +559,7 @@ QgsGrassModuleItem *QgsGrassModuleStandardOptions::item ( QString id )
559559
}
560560
}
561561

562-
QMessageBox::warning( 0, "Warning", "Item with id " + id + " not found" );
562+
QMessageBox::warning( 0, tr("Warning"), tr("Item with id ") + id + tr(" not found" ) );
563563
return 0;
564564
}
565565

@@ -802,7 +802,7 @@ QStringList QgsGrassModuleStandardOptions::checkRegion()
802802
QgsGrass::getDefaultLocation(),
803803
QgsGrass::getDefaultMapset(), &currentWindow ) )
804804
{
805-
QMessageBox::warning( 0, "Warning", "Cannot get current region" );
805+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot get current region") );
806806
return list;
807807
}
808808

@@ -836,8 +836,8 @@ QStringList QgsGrassModuleStandardOptions::checkRegion()
836836
QgsGrass::getDefaultLocation(), mapset, map,
837837
&window ) )
838838
{
839-
QMessageBox::warning( 0, "Warning", "Cannot check region "
840-
"of map " + item->currentMap() );
839+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot check region "
840+
"of map ") + item->currentMap() );
841841
continue;
842842
}
843843

@@ -862,7 +862,7 @@ bool QgsGrassModuleStandardOptions::inputRegion ( struct Cell_head *window, bool
862862
QgsGrass::getDefaultLocation(),
863863
QgsGrass::getDefaultMapset(), window ) )
864864
{
865-
QMessageBox::warning( 0, "Warning", "Cannot get current region" );
865+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot get current region" ) );
866866
return false;
867867
}
868868

@@ -900,8 +900,8 @@ bool QgsGrassModuleStandardOptions::inputRegion ( struct Cell_head *window, bool
900900
QgsGrass::getDefaultLocation(), mapset, map,
901901
&mapWindow ) )
902902
{
903-
QMessageBox::warning( 0, "Warning", "Cannot set region "
904-
"of map " + item->currentMap() );
903+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot set region "
904+
"of map ") + item->currentMap() );
905905
return false;
906906
}
907907

@@ -998,21 +998,21 @@ QString QgsGrassModule::label ( QString path )
998998
path.append ( ".qgm" );
999999
QFile qFile ( path );
10001000
if ( !qFile.exists() ) {
1001-
return QString ( "Not available, decription not found (" + path + ")" );
1001+
return QString ( tr("Not available, decription not found (") + path + tr(")") );
10021002
}
10031003
if ( ! qFile.open( QIODevice::ReadOnly ) ) {
1004-
return QString ( "Not available, cannot open description (" + path + ")" ) ;
1004+
return QString ( tr("Not available, cannot open description (") + path + tr(")") ) ;
10051005
}
10061006
QDomDocument qDoc ( "qgisgrassmodule" );
10071007
QString err;
10081008
int line, column;
10091009
if ( !qDoc.setContent( &qFile, &err, &line, &column ) ) {
1010-
QString errmsg = "Cannot read module file (" + path + "):\n" + err + "\nat line "
1011-
+ QString::number(line) + " column " + QString::number(column);
1010+
QString errmsg = tr("Cannot read module file (") + path + tr("):\n") + err + tr("\nat line ")
1011+
+ QString::number(line) + tr(" column ") + QString::number(column);
10121012
std::cerr << errmsg.toLocal8Bit().data() << std::endl;
1013-
QMessageBox::warning( 0, "Warning", errmsg );
1013+
QMessageBox::warning( 0, tr("Warning"), errmsg );
10141014
qFile.close();
1015-
return QString ( "Not available, incorrect description (" + path + ")" );
1015+
return QString ( tr("Not available, incorrect description (") + path + tr(")") );
10161016
}
10171017
qFile.close();
10181018
QDomElement qDocElem = qDoc.documentElement();
@@ -1164,7 +1164,7 @@ void QgsGrassModule::run()
11641164
{
11651165
err.append ( readyErrors.at(i) + "<br>" );
11661166
}
1167-
QMessageBox::warning ( 0, "Warning", err );
1167+
QMessageBox::warning ( 0, tr("Warning"), err );
11681168
return;
11691169
}
11701170

@@ -1175,7 +1175,7 @@ void QgsGrassModule::run()
11751175
{
11761176
if ( !mOptions->inputRegion ( &tempWindow, false ) )
11771177
{
1178-
QMessageBox::warning ( 0, "Warning", "Cannot get input region" );
1178+
QMessageBox::warning ( 0, tr("Warning"), tr("Cannot get input region") );
11791179
return;
11801180
}
11811181
resetRegion = true;
@@ -1202,8 +1202,8 @@ void QgsGrassModule::run()
12021202
{
12031203
if ( !mOptions->inputRegion ( &tempWindow, true ) )
12041204
{
1205-
QMessageBox::warning ( 0, "Warning",
1206-
"Cannot get input region" );
1205+
QMessageBox::warning ( 0, tr("Warning"),
1206+
tr("Cannot get input region" ) );
12071207
return;
12081208
}
12091209
}
@@ -1304,7 +1304,7 @@ void QgsGrassModule::run()
13041304

13051305
if ( execArguments.size() == 0 )
13061306
{
1307-
QMessageBox::warning( 0, "Warning", "Cannot find module "
1307+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find module ")
13081308
+ mXName );
13091309
return;
13101310
}
@@ -1376,7 +1376,7 @@ void QgsGrassModule::run()
13761376
mProcess.waitForStarted();
13771377
if ( mProcess.state() != QProcess::Running )
13781378
{
1379-
QMessageBox::warning( 0, "Warning", "Cannot start module: "
1379+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot start module: ")
13801380
+ mProcess.errorString() );
13811381
return;
13821382
}
@@ -1395,16 +1395,16 @@ void QgsGrassModule::finished(int exitCode, QProcess::ExitStatus exitStatus )
13951395
std::cerr << "exitCode = " << exitCode << std::endl;
13961396
if ( exitStatus == QProcess::NormalExit ) {
13971397
if ( exitCode == 0 ) {
1398-
mOutputTextBrowser->append( "<B>Successfully finished</B>" );
1398+
mOutputTextBrowser->append( tr("<B>Successfully finished</B>") );
13991399
mProgressBar->setProgress ( 100, 100 );
14001400
mSuccess = true;
14011401
mViewButton->setEnabled(true);
14021402
mOptions->thawOutput();
14031403
} else {
1404-
mOutputTextBrowser->append( "<B>Finished with error</B>" );
1404+
mOutputTextBrowser->append( tr("<B>Finished with error</B>") );
14051405
}
14061406
} else {
1407-
mOutputTextBrowser->append( "<B>Module crashed or killed</B>" );
1407+
mOutputTextBrowser->append( tr("<B>Module crashed or killed</B>") );
14081408
}
14091409
mRunButton->setText( tr("Run") );
14101410
}
@@ -1942,7 +1942,7 @@ QString QgsGrassModuleOption::ready()
19421942
{
19431943
if ( mLineEdits.at(0)->text().trimmed().length() == 0 )
19441944
{
1945-
error.append ( title() + ":&nbsp;missing value" );
1945+
error.append ( title() + tr(":&nbsp;missing value") );
19461946
}
19471947
}
19481948
return error;
@@ -2030,7 +2030,7 @@ QgsGrassModuleInput::QgsGrassModuleInput ( QgsGrassModule *module,
20302030

20312031
if ( optNode.isNull() )
20322032
{
2033-
QMessageBox::warning( 0, "Warning", "Cannot find typeoption " + opt );
2033+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find typeoption ") + opt );
20342034
}
20352035
else
20362036
{
@@ -2039,7 +2039,7 @@ QgsGrassModuleInput::QgsGrassModuleInput ( QgsGrassModule *module,
20392039
QDomNode valuesNode = optNode.namedItem ( "values" );
20402040
if ( valuesNode.isNull() )
20412041
{
2042-
QMessageBox::warning( 0, "Warning", "Cannot find values for typeoption " + opt );
2042+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find values for typeoption ") + opt );
20432043
}
20442044
else
20452045
{
@@ -2100,7 +2100,7 @@ QgsGrassModuleInput::QgsGrassModuleInput ( QgsGrassModule *module,
21002100

21012101
if ( optNode.isNull() )
21022102
{
2103-
QMessageBox::warning( 0, "Warning", "Cannot find layeroption " + opt );
2103+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find layeroption ") + opt );
21042104
}
21052105
else
21062106
{
@@ -2117,7 +2117,7 @@ QgsGrassModuleInput::QgsGrassModuleInput ( QgsGrassModule *module,
21172117
}
21182118
else
21192119
{
2120-
QMessageBox::warning( 0, "Warning", "GRASS element " + element + " not supported" );
2120+
QMessageBox::warning( 0, tr("Warning"), tr("GRASS element ") + element + tr(" not supported") );
21212121
}
21222122

21232123
if ( qdesc.attribute("update") == "yes" ) {
@@ -2141,7 +2141,7 @@ QgsGrassModuleInput::QgsGrassModuleInput ( QgsGrassModule *module,
21412141
mRegionButton = new QPushButton(
21422142
QIcon(iconPath+"grass_set_region.png"), "" );
21432143

2144-
mRegionButton->setToolTip ( "Use region of this map" );
2144+
mRegionButton->setToolTip ( tr("Use region of this map") );
21452145
mRegionButton->setCheckable ( true );
21462146
mRegionButton->setSizePolicy (QSizePolicy::Minimum,
21472147
QSizePolicy:: Preferred );
@@ -2490,7 +2490,7 @@ QString QgsGrassModuleInput::ready()
24902490
std::cerr << "count = " << mLayerComboBox->count() << std::endl;
24912491
if ( mLayerComboBox->count() == 0 )
24922492
{
2493-
error.append ( title() + ":&nbsp;no input" );
2493+
error.append ( title() + tr(":&nbsp;no input") );
24942494
}
24952495
return error;
24962496
}
@@ -2586,7 +2586,7 @@ QgsGrassModuleGdalInput::QgsGrassModuleGdalInput (
25862586

25872587
if ( optNode.isNull() )
25882588
{
2589-
QMessageBox::warning( 0, "Warning", "Cannot find layeroption " + opt );
2589+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot find layeroption ") + opt );
25902590
}
25912591
else
25922592
{
@@ -2712,11 +2712,11 @@ QStringList QgsGrassModuleGdalInput::options()
27122712
// -> layer -> PostGIS -> warning
27132713
if ( mOgrLayers[current].length() > 0 )
27142714
{
2715-
QMessageBox::warning( 0, "Warning",
2716-
"PostGIS driver in OGR does not support schemas!<br>"
2715+
QMessageBox::warning( 0, tr("Warning"),
2716+
tr("PostGIS driver in OGR does not support schemas!<br>"
27172717
"Only the table name will be used.<br>"
27182718
"It can result in wrong input if more tables of the same name<br>"
2719-
"are present in the database." );
2719+
"are present in the database.") );
27202720
}
27212721
}
27222722

@@ -2737,7 +2737,7 @@ QString QgsGrassModuleGdalInput::ready()
27372737
std::cerr << "count = " << mLayerComboBox->count() << std::endl;
27382738
if ( mLayerComboBox->count() == 0 )
27392739
{
2740-
error.append ( title() + ":&nbsp;no input" );
2740+
error.append ( title() + tr(":&nbsp;no input" ) );
27412741
}
27422742
return error;
27432743
}
@@ -2759,7 +2759,7 @@ QgsGrassModuleField::QgsGrassModuleField (
27592759
QString tit;
27602760
if ( mDescription.isEmpty() )
27612761
{
2762-
tit = "Attribute field";
2762+
tit = tr("Attribute field");
27632763
}
27642764
else
27652765
{
@@ -2849,7 +2849,7 @@ QgsGrassModuleSelection::QgsGrassModuleSelection (
28492849
QString tit;
28502850
if ( mDescription.isEmpty() )
28512851
{
2852-
tit = "Attribute field";
2852+
tit = tr("Attribute field");
28532853
}
28542854
else
28552855
{
@@ -2964,7 +2964,7 @@ QgsGrassModuleFile::QgsGrassModuleFile (
29642964
QString tit;
29652965
if ( mDescription.isEmpty() )
29662966
{
2967-
tit = "File";
2967+
tit = tr("File");
29682968
}
29692969
else
29702970
{
@@ -3079,14 +3079,14 @@ QString QgsGrassModuleFile::ready()
30793079

30803080
if ( path.length() == 0 )
30813081
{
3082-
error.append ( title() + ":&nbsp;missing value" );
3082+
error.append ( title() + tr(":&nbsp;missing value") );
30833083
return error;
30843084
}
30853085

30863086
QFileInfo fi(path);
30873087
if ( !fi.dir().exists() )
30883088
{
3089-
error.append ( title() + ":&nbsp;directory does not exist" );
3089+
error.append ( title() + tr(":&nbsp;directory does not exist") );
30903090
}
30913091

30923092
return error;

‎src/plugins/grass/qgsgrassnewmapset.cpp

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ QgsGrassNewMapset::QgsGrassNewMapset ( QgisInterface *iface,
111111
setHelpEnabled ( page(MAPSET), false );
112112
setHelpEnabled ( page(FINISH), false );
113113

114-
setTitle ( page(DATABASE), "GRASS database" );
115-
setTitle ( page(LOCATION), "GRASS location" );
116-
setTitle ( page(PROJECTION), "Projection" );
117-
setTitle ( page(REGION), "Default GRASS Region" );
118-
setTitle ( page(MAPSET), "Mapset" );
119-
setTitle ( page(FINISH), "Create New Mapset" );
114+
setTitle ( page(DATABASE), tr("GRASS database") );
115+
setTitle ( page(LOCATION), tr("GRASS location") );
116+
setTitle ( page(PROJECTION), tr("Projection") );
117+
setTitle ( page(REGION), tr("Default GRASS Region") );
118+
setTitle ( page(MAPSET), tr("Mapset") );
119+
setTitle ( page(FINISH), tr("Create New Mapset") );
120120

121121
setError ( mDatabaseErrorLabel, "" );
122122
setError ( mLocationErrorLabel, "" );
@@ -145,34 +145,34 @@ QgsGrassNewMapset::QgsGrassNewMapset ( QgisInterface *iface,
145145
// Create example tree structure
146146
mTreeListView->clear();
147147
mTreeListView->setSortColumn(-1); // No sorting
148-
mTreeListView->setColumnText( 0, "Tree" );
149-
mTreeListView->addColumn( "Comment" );
150-
Q3ListViewItem *dbi = new Q3ListViewItem( mTreeListView, "OurDatabase", "Database" );
148+
mTreeListView->setColumnText( 0, tr("Tree") );
149+
mTreeListView->addColumn( tr("Comment") );
150+
Q3ListViewItem *dbi = new Q3ListViewItem( mTreeListView, "OurDatabase", tr("Database") );
151151
dbi->setOpen(true);
152152

153153
// First inserted is last in the view
154-
Q3ListViewItem *l = new Q3ListViewItem( dbi, "New Zealand", "Location 2" );
154+
Q3ListViewItem *l = new Q3ListViewItem( dbi, "New Zealand", tr("Location 2") );
155155
l->setOpen(true);
156-
Q3ListViewItem *m = new Q3ListViewItem( l, "Cimrman", "User's mapset");
156+
Q3ListViewItem *m = new Q3ListViewItem( l, "Cimrman", tr("User's mapset") );
157157
m->setOpen(true);
158-
m = new Q3ListViewItem( l, "PERMANENT", "System mapset" );
158+
m = new Q3ListViewItem( l, "PERMANENT", tr("System mapset") );
159159
m->setOpen(true);
160160

161-
l = new Q3ListViewItem( dbi, "Mexico", "Location 1" );
161+
l = new Q3ListViewItem( dbi, "Mexico", tr("Location 1") );
162162
m->setOpen(true);
163-
m = new Q3ListViewItem( l, "Juan", "User's mapset");
163+
m = new Q3ListViewItem( l, "Juan", tr("User's mapset") );
164164
l->setOpen(true);
165-
m = new Q3ListViewItem( l, "Alejandra", "User's mapset");
165+
m = new Q3ListViewItem( l, "Alejandra", tr("User's mapset") );
166166
m->setOpen(true);
167-
m = new Q3ListViewItem( l, "PERMANENT", "System mapset" );
167+
m = new Q3ListViewItem( l, "PERMANENT", tr("System mapset") );
168168
m->setOpen(true);
169169

170170
// PROJECTION
171171

172172
// MAPSET
173173
mMapsetsListView->clear();
174-
mMapsetsListView->setColumnText( 0, "Mapset" );
175-
mMapsetsListView->addColumn( "Owner" );
174+
mMapsetsListView->setColumnText( 0, tr("Mapset") );
175+
mMapsetsListView->addColumn( tr("Owner") );
176176

177177
// FINISH
178178
setFinishEnabled ( page(FINISH), true );
@@ -221,15 +221,15 @@ void QgsGrassNewMapset::databaseChanged()
221221

222222
if ( database.length() == 0 )
223223
{
224-
setError ( mDatabaseErrorLabel, "Enter path to GRASS database");
224+
setError ( mDatabaseErrorLabel, tr("Enter path to GRASS database") );
225225
return;
226226
}
227227

228228
QFileInfo databaseInfo ( mDatabaseLineEdit->text() );
229229

230230
if ( !databaseInfo.exists() )
231231
{
232-
setError ( mDatabaseErrorLabel, "The directory doesn't exist!");
232+
setError ( mDatabaseErrorLabel, tr("The directory doesn't exist!") );
233233
return;
234234
}
235235

@@ -258,8 +258,8 @@ void QgsGrassNewMapset::databaseChanged()
258258
}
259259
else
260260
{
261-
setError ( mDatabaseErrorLabel, "No writable "
262-
"locations, the database not writable!");
261+
setError ( mDatabaseErrorLabel, tr("No writable "
262+
"locations, the database not writable!") );
263263
}
264264
}
265265

@@ -357,7 +357,7 @@ void QgsGrassNewMapset::checkLocation()
357357
if ( location.length() == 0 )
358358
{
359359
setNextEnabled ( page(LOCATION), false );
360-
setError ( mLocationErrorLabel, "Enter location name!");
360+
setError ( mLocationErrorLabel, tr("Enter location name!") );
361361
}
362362
else
363363
{
@@ -370,7 +370,7 @@ void QgsGrassNewMapset::checkLocation()
370370
if ( d[i] == location )
371371
{
372372
setNextEnabled ( page(LOCATION), false );
373-
setError ( mLocationErrorLabel, "The location exists!");
373+
setError ( mLocationErrorLabel, tr("The location exists!") );
374374
break;
375375
}
376376
}
@@ -518,7 +518,7 @@ void QgsGrassNewMapset::setGrassProjection()
518518

519519
if ( !mProjInfo || !mProjUnits )
520520
{
521-
setError ( mProjErrorLabel, "Selected projection is not supported by GRASS!");
521+
setError ( mProjErrorLabel, tr("Selected projection is not supported by GRASS!") );
522522
}
523523
}
524524
else // Nothing selected
@@ -564,8 +564,8 @@ void QgsGrassNewMapset::setRegionPage()
564564
newSrs.createFromSrsId ( mProjectionSelector->getCurrentSRSID() );
565565
if ( ! newSrs.isValid() )
566566
{
567-
QMessageBox::warning( 0, "Warning",
568-
"Cannot create projection." );
567+
QMessageBox::warning( 0, tr("Warning"),
568+
tr("Cannot create projection.") );
569569
}
570570
}
571571
}
@@ -612,8 +612,8 @@ void QgsGrassNewMapset::setRegionPage()
612612
}
613613
else
614614
{
615-
QMessageBox::warning( 0, "Warning", "Cannot reproject "
616-
"previously set region, default region set." );
615+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot reproject "
616+
"previously set region, default region set." ) );
617617

618618
setGrassRegionDefaults();
619619
}
@@ -748,12 +748,12 @@ void QgsGrassNewMapset::checkRegion()
748748

749749
if ( n <= s )
750750
{
751-
setError ( mRegionErrorLabel, "North must be greater than south");
751+
setError ( mRegionErrorLabel, tr("North must be greater than south") );
752752
err = true;
753753
}
754754
if ( e <= w && mCellHead.proj != PROJECTION_LL )
755755
{
756-
setError ( mRegionErrorLabel, "East must be greater than west");
756+
setError ( mRegionErrorLabel, tr("East must be greater than west") );
757757
err = true;
758758
}
759759

@@ -799,13 +799,13 @@ void QgsGrassNewMapset::loadRegions()
799799
QFile file ( path );
800800

801801
if ( !file.exists() ) {
802-
QMessageBox::warning( 0, "Warning",
803-
"Regions file (" + path + ") not found." );
802+
QMessageBox::warning( 0, tr("Warning"),
803+
tr("Regions file (") + path + tr(") not found.") );
804804
return;
805805
}
806806
if ( ! file.open( QIODevice::ReadOnly ) ) {
807-
QMessageBox::warning( 0, "Warning",
808-
"Cannot open locations file (" + path +")" );
807+
QMessageBox::warning( 0, tr("Warning"),
808+
tr("Cannot open locations file (") + path +tr(")") );
809809
return;
810810
}
811811

@@ -814,11 +814,11 @@ void QgsGrassNewMapset::loadRegions()
814814
int line, column;
815815

816816
if ( !doc.setContent( &file, &err, &line, &column ) ) {
817-
QString errmsg = "Cannot read locations file (" + path + "):\n"
818-
+ err + "\nat line " + QString::number(line)
819-
+ " column " + QString::number(column);
817+
QString errmsg = tr("Cannot read locations file (") + path + tr("):\n")
818+
+ err + tr("\nat line ") + QString::number(line)
819+
+ tr(" column ") + QString::number(column);
820820
std::cerr << errmsg.toLocal8Bit().data() << std::endl;
821-
QMessageBox::warning( 0, "Warning", errmsg );
821+
QMessageBox::warning( 0, tr("Warning"), errmsg );
822822
file.close();
823823
return;
824824
}
@@ -910,8 +910,8 @@ void QgsGrassNewMapset::setSelectedRegion()
910910

911911
if ( !source.isValid() )
912912
{
913-
QMessageBox::warning( 0, "Warning",
914-
"Cannot create QgsSpatialRefSys" );
913+
QMessageBox::warning( 0, tr("Warning"),
914+
tr("Cannot create QgsSpatialRefSys" ) );
915915
return;
916916
}
917917

@@ -920,8 +920,8 @@ void QgsGrassNewMapset::setSelectedRegion()
920920

921921
if ( !dest.isValid() )
922922
{
923-
QMessageBox::warning( 0, "Warning",
924-
"Cannot create QgsSpatialRefSys" );
923+
QMessageBox::warning( 0, tr("Warning"),
924+
tr("Cannot create QgsSpatialRefSys") );
925925
return;
926926
}
927927

@@ -950,8 +950,8 @@ void QgsGrassNewMapset::setSelectedRegion()
950950

951951
if ( !ok )
952952
{
953-
QMessageBox::warning( 0, "Warning",
954-
"Cannot reproject selected region." );
953+
QMessageBox::warning( 0, tr("Warning"),
954+
tr( "Cannot reproject selected region.") );
955955
return;
956956
}
957957
}
@@ -1039,7 +1039,7 @@ void QgsGrassNewMapset::setCurrentRegion()
10391039

10401040
if ( !ok )
10411041
{
1042-
QMessageBox::warning( 0, "Warning", "Cannot reproject region" );
1042+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot reproject region") );
10431043
return;
10441044
}
10451045
}
@@ -1133,17 +1133,17 @@ void QgsGrassNewMapset::drawRegion()
11331133

11341134
if ( !source.isValid() )
11351135
{
1136-
QMessageBox::warning( 0, "Warning",
1137-
"Cannot create QgsSpatialRefSys" );
1136+
QMessageBox::warning( 0, tr("Warning"),
1137+
tr("Cannot create QgsSpatialRefSys") );
11381138
return;
11391139
}
11401140

11411141
QgsSpatialRefSys dest ( 2585, QgsSpatialRefSys::QGIS_SRSID );
11421142

11431143
if ( !dest.isValid() )
11441144
{
1145-
QMessageBox::warning( 0, "Warning",
1146-
"Cannot create QgsSpatialRefSys" );
1145+
QMessageBox::warning( 0, tr("Warning"),
1146+
tr("Cannot create QgsSpatialRefSys") );
11471147
return;
11481148
}
11491149

@@ -1270,7 +1270,7 @@ void QgsGrassNewMapset::mapsetChanged()
12701270
// TODO?: Check spaces in the name
12711271
if ( mapset.length() == 0 )
12721272
{
1273-
setError ( mMapsetErrorLabel, "Enter mapset name.");
1273+
setError ( mMapsetErrorLabel, tr("Enter mapset name."));
12741274
return;
12751275
}
12761276

@@ -1287,7 +1287,7 @@ void QgsGrassNewMapset::mapsetChanged()
12871287

12881288
if ( d[i] == mapset )
12891289
{
1290-
setError ( mMapsetErrorLabel, "The mapset already exists");
1290+
setError ( mMapsetErrorLabel, tr("The mapset already exists") );
12911291
exists = true;
12921292
break;
12931293
}
@@ -1311,7 +1311,7 @@ void QgsGrassNewMapset::setFinishPage()
13111311
std::cerr << "QgsGrassNewMapset::setFinish()" << std::endl;
13121312
#endif
13131313

1314-
mDatabaseLabel->setText ( "Database: " + mDatabaseLineEdit->text() );
1314+
mDatabaseLabel->setText ( tr("Database: ") + mDatabaseLineEdit->text() );
13151315

13161316
QString location;
13171317
if ( mSelectLocationRadioButton->isChecked() )
@@ -1322,9 +1322,9 @@ void QgsGrassNewMapset::setFinishPage()
13221322
{
13231323
location = mLocationLineEdit->text().stripWhiteSpace();
13241324
}
1325-
mLocationLabel->setText ( "Location: " + location );
1325+
mLocationLabel->setText ( tr("Location: ") + location );
13261326

1327-
mMapsetLabel->setText ( "Mapset: " + mMapsetLineEdit->text() );
1327+
mMapsetLabel->setText ( tr("Mapset: ") + mMapsetLineEdit->text() );
13281328

13291329
setFinishEnabled ( page(FINISH), true );
13301330
}
@@ -1355,8 +1355,8 @@ void QgsGrassNewMapset::createMapset()
13551355

13561356
if ( ret != 0 )
13571357
{
1358-
QMessageBox::warning (this, "Create location",
1359-
"Cannot create new location: "
1358+
QMessageBox::warning (this, tr("Create location"),
1359+
tr("Cannot create new location: ")
13601360
+ QgsGrass::getErrorMessage() );
13611361

13621362
return;
@@ -1386,8 +1386,8 @@ void QgsGrassNewMapset::createMapset()
13861386

13871387
if ( !d.mkdir(mapset) )
13881388
{
1389-
QMessageBox::warning (this, "Create mapset",
1390-
"Cannot create new mapset dircetory" );
1389+
QMessageBox::warning (this, tr("Create mapset"),
1390+
tr("Cannot create new mapset dircetory") );
13911391

13921392
return;
13931393
}
@@ -1397,14 +1397,14 @@ void QgsGrassNewMapset::createMapset()
13971397
QFile in ( locationPath + "/PERMANENT/DEFAULT_WIND" );
13981398
if ( !in.open( QIODevice::ReadOnly ) )
13991399
{
1400-
QMessageBox::warning (this, "Create mapset", "Cannot open DEFAULT_WIND" );
1400+
QMessageBox::warning (this, tr("Create mapset"), tr("Cannot open DEFAULT_WIND") );
14011401
return;
14021402
}
14031403

14041404
QFile out ( locationPath + "/" + mapset + "/WIND" );
14051405
if ( !out.open( QIODevice::WriteOnly ) )
14061406
{
1407-
QMessageBox::warning (this, "Create mapset", "Cannot open WIND" );
1407+
QMessageBox::warning (this, tr("Create mapset"), tr("Cannot open WIND") );
14081408
return;
14091409
}
14101410
QTextStream stream ( &out );
@@ -1425,15 +1425,15 @@ void QgsGrassNewMapset::createMapset()
14251425

14261426
if ( err.length() > 0 )
14271427
{
1428-
QMessageBox::information ( this, "New mapset",
1429-
"New mapset successfully created, but cannot be "
1430-
"opened: " + err );
1428+
QMessageBox::information ( this, tr("New mapset"),
1429+
tr("New mapset successfully created, but cannot be "
1430+
"opened: ") + err );
14311431
}
14321432
else
14331433
{
1434-
QMessageBox::information ( this, "New mapset",
1435-
"New mapset successfully created and set "
1436-
"as current working mapset." );
1434+
QMessageBox::information ( this, tr("New mapset"),
1435+
tr("New mapset successfully created and set "
1436+
"as current working mapset.") );
14371437

14381438
mPlugin->mapsetChanged();
14391439
}

‎src/plugins/grass/qgsgrassplugin.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void QgsGrassPlugin::initGui()
174174
tr("Edit Current Grass Region"), this);
175175
mEditAction = new QAction(QIcon(icon_grass_edit),
176176
tr("Edit Grass Vector layer"), this);
177-
mNewVectorAction = new QAction(QIcon(icon_new_vector_layer),"Create new Grass Vector", this);
177+
mNewVectorAction = new QAction(QIcon(icon_new_vector_layer),tr("Create new Grass Vector"), this);
178178

179179
mAddVectorAction->setWhatsThis(tr("Adds a GRASS vector layer to the map canvas"));
180180
mAddRasterAction->setWhatsThis(tr("Adds a GRASS raster layer to the map canvas"));
@@ -439,7 +439,7 @@ void QgsGrassPlugin::openTools()
439439
void QgsGrassPlugin::edit()
440440
{
441441
if ( QgsGrassEdit::isRunning() ) {
442-
QMessageBox::warning( 0, "Warning", "GRASS Edit is already running." );
442+
QMessageBox::warning( 0, tr("Warning"), tr("GRASS Edit is already running.") );
443443
return;
444444
}
445445

@@ -481,16 +481,16 @@ void QgsGrassPlugin::newVector()
481481
#endif
482482

483483
if ( QgsGrassEdit::isRunning() ) {
484-
QMessageBox::warning( 0, "Warning", "GRASS Edit is already running." );
484+
QMessageBox::warning( 0, tr("Warning"), tr("GRASS Edit is already running." ) );
485485
return;
486486
}
487487

488488
bool ok;
489489
QString name;
490490

491491
QgsGrassElementDialog dialog;
492-
name = dialog.getItem ( "vector", "New vector name",
493-
"New vector name", "", "", &ok );
492+
name = dialog.getItem ( "vector", tr("New vector name"),
493+
tr("New vector name"), "", "", &ok );
494494

495495
if ( !ok ) return;
496496

@@ -505,7 +505,7 @@ void QgsGrassPlugin::newVector()
505505

506506
if ( QgsGrass::getError() == QgsGrass::FATAL )
507507
{
508-
QMessageBox::warning( 0, "Warning", "Cannot create new vector: "
508+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot create new vector: ")
509509
+ QgsGrass::getErrorMessage() );
510510
return;
511511
}
@@ -527,8 +527,8 @@ void QgsGrassPlugin::newVector()
527527

528528
if ( !provider )
529529
{
530-
QMessageBox::warning( 0, "Warning", "New vector created "
531-
"but cannot beopened by data provider." );
530+
QMessageBox::warning( 0, tr("Warning"), tr("New vector created "
531+
"but cannot be opened by data provider.") );
532532
return;
533533
}
534534

@@ -539,12 +539,12 @@ void QgsGrassPlugin::newVector()
539539
ed->show();
540540
mCanvas->refresh();
541541
} else {
542-
QMessageBox::warning( 0, "Warning", "Cannot start editing." );
542+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot start editing." ) );
543543
delete ed;
544544
}
545545
/*
546546
if ( !(mProvider->startEdit()) ) {
547-
QMessageBox::warning( 0, "Warning", "Cannot open vector for update." );
547+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot open vector for update.") );
548548
return;
549549
}
550550
*/
@@ -575,8 +575,8 @@ void QgsGrassPlugin::displayRegion()
575575
QString mapset = QgsGrass::getDefaultMapset();
576576

577577
if ( gisdbase.isEmpty() || location.isEmpty() || mapset.isEmpty() ) {
578-
QMessageBox::warning( 0, "Warning", "GISDBASE, LOCATION_NAME or MAPSET is not set, "
579-
"cannot display current region." );
578+
QMessageBox::warning( 0, tr("Warning"), tr("GISDBASE, LOCATION_NAME or MAPSET is not set, "
579+
"cannot display current region.") );
580580
return;
581581
}
582582

@@ -586,7 +586,7 @@ void QgsGrassPlugin::displayRegion()
586586
char *err = G__get_window ( &window, "", "WIND", (char *) mapset.latin1() );
587587

588588
if ( err ) {
589-
QMessageBox::warning( 0, "Warning", "Cannot read current region: " + QString(err) );
589+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot read current region: ") + QString(err) );
590590
return;
591591
}
592592

@@ -690,7 +690,7 @@ void QgsGrassPlugin::openMapset()
690690

691691
if ( !err.isNull() )
692692
{
693-
QMessageBox::warning( 0, "Warning", "Cannot open the mapset. " + err );
693+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot open the mapset. ") + err );
694694
return;
695695
}
696696

@@ -708,7 +708,7 @@ void QgsGrassPlugin::closeMapset()
708708

709709
if ( !err.isNull() )
710710
{
711-
QMessageBox::warning( 0, "Warning", "Cannot close mapset. " + err );
711+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot close mapset. ") + err );
712712
return;
713713
}
714714

@@ -763,8 +763,8 @@ void QgsGrassPlugin::projectRead()
763763
QString err = QgsGrass::closeMapset ();
764764
if ( !err.isNull() )
765765
{
766-
QMessageBox::warning( 0, "Warning",
767-
"Cannot close current mapset. " + err );
766+
QMessageBox::warning( 0, tr("Warning"),
767+
tr("Cannot close current mapset. ") + err );
768768
return;
769769
}
770770
mapsetChanged();
@@ -773,7 +773,7 @@ void QgsGrassPlugin::projectRead()
773773

774774
if ( !err.isNull() )
775775
{
776-
QMessageBox::warning( 0, "Warning", "Cannot open GRASS mapset. " + err );
776+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot open GRASS mapset. ") + err );
777777
return;
778778
}
779779

‎src/plugins/grass/qgsgrassregion.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ QgsGrassRegion::QgsGrassRegion ( QgsGrassPlugin *plugin, QgisInterface *iface,
192192
QString mapset = QgsGrass::getDefaultMapset();
193193

194194
if ( gisdbase.isEmpty() || location.isEmpty() || mapset.isEmpty() ) {
195-
QMessageBox::warning( 0, "Warning", "GISDBASE, LOCATION_NAME or MAPSET is not set, "
196-
"cannot display current region." );
195+
QMessageBox::warning( 0, tr("Warning"), tr("GISDBASE, LOCATION_NAME or MAPSET is not set, "
196+
"cannot display current region." ) );
197197
}
198198

199199
QgsGrass::setLocation ( gisdbase, location );
200200
char *err = G__get_window ( &mWindow, "", "WIND", (char *) mapset.latin1() );
201201

202202
if ( err ) {
203-
QMessageBox::warning( 0, "Warning", "Cannot read current region: " + QString(err) );
203+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot read current region: ") + QString(err) );
204204
return;
205205
}
206206

@@ -457,7 +457,7 @@ void QgsGrassRegion::accept()
457457
G__setenv( "MAPSET", (char *) QgsGrass::getDefaultMapset().latin1() );
458458

459459
if ( G_put_window(&mWindow) == -1 ) {
460-
QMessageBox::warning( 0, "Warning", "Cannot write region" );
460+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot write region") );
461461
return;
462462
}
463463

‎src/plugins/grass/qgsgrasstools.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
9696
std::cerr << "QgsGrassTools()" << std::endl;
9797
#endif
9898

99-
setWindowTitle ( "GRASS Tools" );
99+
setWindowTitle ( tr("GRASS Tools") );
100100
// setupUi(this);
101101

102102
mIface = iface;
@@ -126,7 +126,7 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
126126
connect( mModulesListView, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
127127
this, SLOT(moduleClicked( QTreeWidgetItem *, int)) );
128128

129-
QString title = "GRASS Tools: " + QgsGrass::getDefaultLocation()
129+
QString title = tr("GRASS Tools: ") + QgsGrass::getDefaultLocation()
130130
+ "/" + QgsGrass::getDefaultMapset();
131131
setCaption(title);
132132

@@ -207,8 +207,8 @@ void QgsGrassTools::moduleClicked( QTreeWidgetItem * item, int column )
207207

208208
if ( !file.exists() )
209209
{
210-
QMessageBox::warning( 0, "Warning",
211-
"Cannot find MSYS (" + msysPath + ")" );
210+
QMessageBox::warning( 0, tr("Warning"),
211+
tr("Cannot find MSYS (") + msysPath + ")" );
212212
}
213213
else
214214
{
@@ -230,7 +230,7 @@ void QgsGrassTools::moduleClicked( QTreeWidgetItem * item, int column )
230230
sh = new QgsGrassShell(this, mTabWidget);
231231
m = dynamic_cast<QWidget *> ( sh );
232232
#else
233-
QMessageBox::warning( 0, "Warning", "GRASS Shell is not compiled." );
233+
QMessageBox::warning( 0, tr("Warning"), tr("GRASS Shell is not compiled.") );
234234
#endif // HAVE_OPENPTY
235235

236236
#endif // ! WIN32
@@ -280,22 +280,22 @@ bool QgsGrassTools::loadConfig(QString filePath)
280280
QFile file ( filePath );
281281

282282
if ( !file.exists() ) {
283-
QMessageBox::warning( 0, "Warning", "The config file (" + filePath + ") not found." );
283+
QMessageBox::warning( 0, tr("Warning"), tr("The config file (") + filePath + tr(") not found.") );
284284
return false;
285285
}
286286
if ( ! file.open( QIODevice::ReadOnly ) ) {
287-
QMessageBox::warning( 0, "Warning", "Cannot open config file (" + filePath + ")" );
287+
QMessageBox::warning( 0, tr("Warning"), tr("Cannot open config file (") + filePath + tr(")") );
288288
return false;
289289
}
290290

291291
QDomDocument doc ( "qgisgrass" );
292292
QString err;
293293
int line, column;
294294
if ( !doc.setContent( &file, &err, &line, &column ) ) {
295-
QString errmsg = "Cannot read config file (" + filePath + "):\n" + err + "\nat line "
296-
+ QString::number(line) + " column " + QString::number(column);
295+
QString errmsg = tr("Cannot read config file (") + filePath + "):\n" + err + tr("\nat line ")
296+
+ QString::number(line) + tr(" column ") + QString::number(column);
297297
std::cerr << errmsg.toLocal8Bit().data() << std::endl;
298-
QMessageBox::warning( 0, "Warning", errmsg );
298+
QMessageBox::warning( 0, tr("Warning"), errmsg );
299299
file.close();
300300
return false;
301301
}
@@ -375,7 +375,7 @@ void QgsGrassTools::mapsetChanged()
375375
std::cerr << "QgsGrassTools::mapsetChanged()" << std::endl;
376376
#endif
377377

378-
QString title = "GRASS Tools: " + QgsGrass::getDefaultLocation()
378+
QString title = tr("GRASS Tools: ") + QgsGrass::getDefaultLocation()
379379
+ "/" + QgsGrass::getDefaultMapset();
380380
setCaption(title);
381381

‎src/plugins/grass/qgsgrassutils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ QString QgsGrassElementDialog::getItem ( QString element,
128128
mErrorLabel->setMinimumHeight ( mErrorLabel->height()+5 );
129129

130130
mOkButton = new QPushButton ( );
131-
mCancelButton = new QPushButton ( "Cancel" );
131+
mCancelButton = new QPushButton ( tr("Cancel" ) );
132132

133133
layout->insertLayout( -1, buttonLayout );
134134
buttonLayout->addWidget( mOkButton );
@@ -159,12 +159,12 @@ void QgsGrassElementDialog::textChanged ()
159159
QString text = mLineEdit->text().trimmed();
160160

161161
mErrorLabel->setText ( " " );
162-
mOkButton->setText ("Ok");
162+
mOkButton->setText ( tr("Ok" ) );
163163
mOkButton->setEnabled ( true );
164164

165165
if ( text.length() == 0 )
166166
{
167-
mErrorLabel->setText ( "<font color='red'>Enter a name!</font>" );
167+
mErrorLabel->setText ( tr( "<font color='red'>Enter a name!</font>" ) );
168168
mOkButton->setEnabled ( false );
169169
return;
170170
}
@@ -175,14 +175,14 @@ void QgsGrassElementDialog::textChanged ()
175175
if ( !mSource.isNull() && text == mSource )
176176
#endif
177177
{
178-
mErrorLabel->setText ( "<font color='red'>This is name of the source!</font>" );
178+
mErrorLabel->setText ( tr( "<font color='red'>This is name of the source!</font>" ) );
179179
mOkButton->setEnabled ( false );
180180
return;
181181
}
182182
if ( QgsGrassUtils::itemExists( mElement, text ) )
183183
{
184-
mErrorLabel->setText ( "<font color='red'>Exists!</font>" );
185-
mOkButton->setText ("Overwrite");
184+
mErrorLabel->setText ( tr( "<font color='red'>Exists!</font>" ) );
185+
mOkButton->setText ( tr("Overwrite") );
186186
return;
187187
}
188188
}

0 commit comments

Comments
 (0)
Please sign in to comment.