Browse Source

More translation hooks

Neal Wilson 9 years ago
parent
commit
2de9523c56
1 changed files with 20 additions and 5 deletions
  1. 20
    5
      src/typica.w

+ 20
- 5
src/typica.w View File

4803
                 QWidget *widget = new QWidget;
4803
                 QWidget *widget = new QWidget;
4804
                 layout->addWidget(widget);
4804
                 layout->addWidget(widget);
4805
                 widgetStack->push(widget);
4805
                 widgetStack->push(widget);
4806
+                currentElement.setAttribute("trcontext", element.attribute("trcontext"));
4806
                 populateWidget(currentElement, widgetStack, layoutStack);
4807
                 populateWidget(currentElement, widgetStack, layoutStack);
4807
                 widgetStack->pop();
4808
                 widgetStack->pop();
4808
             }
4809
             }
4913
             QHBoxLayout *cell = new QHBoxLayout;
4914
             QHBoxLayout *cell = new QHBoxLayout;
4914
             layout->addLayout(cell, row, column, vspan, hspan);
4915
             layout->addLayout(cell, row, column, vspan, hspan);
4915
             layoutStack->push(cell);
4916
             layoutStack->push(cell);
4917
+            columnElement.setAttribute("trcontext", element.attribute("trcontext"));
4916
             populateBoxLayout(columnElement, widgetStack, layoutStack);
4918
             populateBoxLayout(columnElement, widgetStack, layoutStack);
4917
             layoutStack->pop();
4919
             layoutStack->pop();
4918
         }
4920
         }
4935
         if(current.isElement())
4937
         if(current.isElement())
4936
         {
4938
         {
4937
             currentElement = current.toElement();
4939
             currentElement = current.toElement();
4940
+            currentElement.setAttribute("trcontext", element.attribute("trcontext"));
4938
             if(currentElement.tagName() == "button")
4941
             if(currentElement.tagName() == "button")
4939
             {
4942
             {
4940
                 addButtonToLayout(currentElement, widgetStack, layoutStack);
4943
                 addButtonToLayout(currentElement, widgetStack, layoutStack);
4960
             {
4963
             {
4961
                 QBoxLayout *layout =
4964
                 QBoxLayout *layout =
4962
                     qobject_cast<QBoxLayout *>(layoutStack->top());
4965
                     qobject_cast<QBoxLayout *>(layoutStack->top());
4963
-                QLabel *label = new QLabel(currentElement.text());
4966
+                QLabel *label = new QLabel(QCoreApplication::translate(
4967
+                    element.attribute("trcontext").toAscii().data(),
4968
+                    currentElement.text().toUtf8().data()));
4964
                 layout->addWidget(label);
4969
                 layout->addWidget(label);
4965
             }
4970
             }
4966
             else if(currentElement.tagName() == "lcdtemperature")
4971
             else if(currentElement.tagName() == "lcdtemperature")
5104
         if(current.isElement())
5109
         if(current.isElement())
5105
         {
5110
         {
5106
             currentElement = current.toElement();
5111
             currentElement = current.toElement();
5112
+            currentElement.setAttribute("trcontext", element.attribute("trcontext"));
5107
             if(currentElement.tagName() == "decoration")
5113
             if(currentElement.tagName() == "decoration")
5108
             {
5114
             {
5109
                 addDecorationToSplitter(currentElement, widgetStack,
5115
                 addDecorationToSplitter(currentElement, widgetStack,
5249
 labeled.
5255
 labeled.
5250
 
5256
 
5251
 @<Set up decoration@>=
5257
 @<Set up decoration@>=
5252
-QString labelText = element.attribute("name");
5258
+QString labelText =
5259
+    QCoreApplication::translate(element.attribute("trcontext").toAscii().data(),
5260
+    element.attribute("name").toUtf8().data());
5253
 Qt::Orientations@, orientation = Qt::Horizontal;
5261
 Qt::Orientations@, orientation = Qt::Horizontal;
5254
 if(element.hasAttribute("type"))
5262
 if(element.hasAttribute("type"))
5255
 {
5263
 {
5345
             currentElement = current.toElement();
5353
             currentElement = current.toElement();
5346
             if(currentElement.tagName() == "layout")
5354
             if(currentElement.tagName() == "layout")
5347
             {
5355
             {
5356
+                currentElement.setAttribute("trcontext", element.attribute("trcontext"));
5348
                 addLayoutToWidget(currentElement, widgetStack, layoutStack);
5357
                 addLayoutToWidget(currentElement, widgetStack, layoutStack);
5349
             }
5358
             }
5350
         }
5359
         }
5360
                        QStack<QLayout *> *layoutStack)
5369
                        QStack<QLayout *> *layoutStack)
5361
 {
5370
 {
5362
     QAbstractButton *button = NULL;
5371
     QAbstractButton *button = NULL;
5363
-    QString text = element.attribute("name");
5372
+    QString text =
5373
+        QCoreApplication::translate(element.attribute("trcontext").toAscii().data(),
5374
+                                    element.attribute("name").toUtf8().data());
5364
     if(element.hasAttribute("type"))
5375
     if(element.hasAttribute("type"))
5365
     {
5376
     {
5366
         QString type = element.attribute("type");
5377
         QString type = element.attribute("type");
5414
     AnnotationSpinBox *box = new AnnotationSpinBox("", "", NULL);
5425
     AnnotationSpinBox *box = new AnnotationSpinBox("", "", NULL);
5415
     if(element.hasAttribute("pretext"))
5426
     if(element.hasAttribute("pretext"))
5416
     {
5427
     {
5417
-        box->setPretext(element.attribute("pretext"));
5428
+        box->setPretext(QCoreApplication::translate(
5429
+                        element.attribute("trcontext").toAscii().data(),
5430
+                        element.attribute("pretext").toUtf8().data()));
5418
     }
5431
     }
5419
     if(element.hasAttribute("posttext"))
5432
     if(element.hasAttribute("posttext"))
5420
     {
5433
     {
5421
-        box->setPosttext(element.attribute("posttext"));
5434
+        box->setPosttext(QCoreApplication::translate(
5435
+                         element.attribute("trcontext").toAscii().data(),
5436
+                         element.attribute("posttext").toUtf8().data()));
5422
     }
5437
     }
5423
     if(element.hasAttribute("series"))
5438
     if(element.hasAttribute("series"))
5424
     {
5439
     {

Loading…
Cancel
Save