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,6 +4803,7 @@ void populateStackedLayout(QDomElement element, QStack<QWidget *> *widgetStack,
4803 4803
                 QWidget *widget = new QWidget;
4804 4804
                 layout->addWidget(widget);
4805 4805
                 widgetStack->push(widget);
4806
+                currentElement.setAttribute("trcontext", element.attribute("trcontext"));
4806 4807
                 populateWidget(currentElement, widgetStack, layoutStack);
4807 4808
                 widgetStack->pop();
4808 4809
             }
@@ -4913,6 +4914,7 @@ for(int j = 0; j < rowChildren.count(); j++)
4913 4914
             QHBoxLayout *cell = new QHBoxLayout;
4914 4915
             layout->addLayout(cell, row, column, vspan, hspan);
4915 4916
             layoutStack->push(cell);
4917
+            columnElement.setAttribute("trcontext", element.attribute("trcontext"));
4916 4918
             populateBoxLayout(columnElement, widgetStack, layoutStack);
4917 4919
             layoutStack->pop();
4918 4920
         }
@@ -4935,6 +4937,7 @@ void populateBoxLayout(QDomElement element, QStack<QWidget *> *widgetStack,
4935 4937
         if(current.isElement())
4936 4938
         {
4937 4939
             currentElement = current.toElement();
4940
+            currentElement.setAttribute("trcontext", element.attribute("trcontext"));
4938 4941
             if(currentElement.tagName() == "button")
4939 4942
             {
4940 4943
                 addButtonToLayout(currentElement, widgetStack, layoutStack);
@@ -4960,7 +4963,9 @@ void populateBoxLayout(QDomElement element, QStack<QWidget *> *widgetStack,
4960 4963
             {
4961 4964
                 QBoxLayout *layout =
4962 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 4969
                 layout->addWidget(label);
4965 4970
             }
4966 4971
             else if(currentElement.tagName() == "lcdtemperature")
@@ -5104,6 +5109,7 @@ void populateSplitter(QDomElement element, QStack<QWidget *> *widgetStack,@|
5104 5109
         if(current.isElement())
5105 5110
         {
5106 5111
             currentElement = current.toElement();
5112
+            currentElement.setAttribute("trcontext", element.attribute("trcontext"));
5107 5113
             if(currentElement.tagName() == "decoration")
5108 5114
             {
5109 5115
                 addDecorationToSplitter(currentElement, widgetStack,
@@ -5249,7 +5255,9 @@ void addDecorationToSplitter(QDomElement element,
5249 5255
 labeled.
5250 5256
 
5251 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 5261
 Qt::Orientations@, orientation = Qt::Horizontal;
5254 5262
 if(element.hasAttribute("type"))
5255 5263
 {
@@ -5345,6 +5353,7 @@ void populateWidget(QDomElement element, QStack<QWidget *> *widgetStack,@|
5345 5353
             currentElement = current.toElement();
5346 5354
             if(currentElement.tagName() == "layout")
5347 5355
             {
5356
+                currentElement.setAttribute("trcontext", element.attribute("trcontext"));
5348 5357
                 addLayoutToWidget(currentElement, widgetStack, layoutStack);
5349 5358
             }
5350 5359
         }
@@ -5360,7 +5369,9 @@ void addButtonToLayout(QDomElement element, QStack<QWidget *> *,@|
5360 5369
                        QStack<QLayout *> *layoutStack)
5361 5370
 {
5362 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 5375
     if(element.hasAttribute("type"))
5365 5376
     {
5366 5377
         QString type = element.attribute("type");
@@ -5414,11 +5425,15 @@ void addSpinBoxToLayout(QDomElement element, QStack<QWidget *> *,@|
5414 5425
     AnnotationSpinBox *box = new AnnotationSpinBox("", "", NULL);
5415 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 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 5438
     if(element.hasAttribute("series"))
5424 5439
     {

Loading…
Cancel
Save