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
         }
4616
         }
4617
         else if(element.tagName() == "layout")
4617
         else if(element.tagName() == "layout")
4618
         {
4618
         {
4619
+            element.setAttribute("trcontext", targetID);
4619
             addLayoutToWidget(element, &widgetStack, &layoutStack);
4620
             addLayoutToWidget(element, &widgetStack, &layoutStack);
4620
         }
4621
         }
4621
         else if(element.tagName() == "menu")
4622
         else if(element.tagName() == "menu")
4648
 bar->setObjectName("menuBar");
4649
 bar->setObjectName("menuBar");
4649
 if(element.hasAttribute("name"))
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
     menu->setParent(bar);
4654
     menu->setParent(bar);
4653
     if(element.hasAttribute("type"))
4655
     if(element.hasAttribute("type"))
4654
     {
4656
     {
4680
         QDomElement itemElement = item.toElement();
4682
         QDomElement itemElement = item.toElement();
4681
         if(itemElement.tagName() == "item")
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
             if(itemElement.hasAttribute("id"))
4687
             if(itemElement.hasAttribute("id"))
4685
             {
4688
             {
4686
                 itemAction->setObjectName(itemElement.attribute("id"));
4689
                 itemAction->setObjectName(itemElement.attribute("id"));

Loading…
Cancel
Save