Browse Source

WIP: Support for translating display text from configuration files.

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

+ 5
- 2
src/typica.w View File

@@ -4616,6 +4616,7 @@ while(i < windowChildren.count())
4616 4616
         }
4617 4617
         else if(element.tagName() == "layout")
4618 4618
         {
4619
+            element.setAttribute("trcontext", targetID);
4619 4620
             addLayoutToWidget(element, &widgetStack, &layoutStack);
4620 4621
         }
4621 4622
         else if(element.tagName() == "menu")
@@ -4648,7 +4649,8 @@ bar->setParent(window);
4648 4649
 bar->setObjectName("menuBar");
4649 4650
 if(element.hasAttribute("name"))
4650 4651
 {
4651
-    QMenu *menu = bar->addMenu(element.attribute("name"));
4652
+    QMenu *menu = bar->addMenu(QCoreApplication::translate(targetID.toAscii().data(),
4653
+                                                           element.attribute("name").toUtf8().data()));
4652 4654
     menu->setParent(bar);
4653 4655
     if(element.hasAttribute("type"))
4654 4656
     {
@@ -4680,7 +4682,8 @@ while(j < menuItems.count())
4680 4682
         QDomElement itemElement = item.toElement();
4681 4683
         if(itemElement.tagName() == "item")
4682 4684
         {
4683
-            QAction *itemAction = new QAction(itemElement.text(), menu);
4685
+            QAction *itemAction = new QAction(QCoreApplication::translate(targetID.toAscii().data(),
4686
+                                              itemElement.text().toUtf8().data()), menu);
4684 4687
             if(itemElement.hasAttribute("id"))
4685 4688
             {
4686 4689
                 itemAction->setObjectName(itemElement.attribute("id"));

Loading…
Cancel
Save