Blackberry 10级联InvokeActionItem标题更改onlanguage切换

时间:2013-10-31 15:19:47

标签: qml blackberry-10 blackberry-cascades bb-messenger

请查找以下Qml代码

actions: [

                ActionItem {
                    title: qsTr("Custom Market Watch") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        _app.dropSymbols(1); // Drop Req for Tadawul
                        lightTimer.stop();
                        _app.GenerateCustWatch(1, translate.text);

                    }
                },

                ActionItem {

                    title: qsTr("Alerts") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        _app.dropSymbols(1); // Drop Req for Tadawul
                        lightTimer.stop();
                        _app.AddAlerts(1, translate.text);

                    }
                    imageSource: "asset:///images/alert_title_icon.png"
                },
                ActionItem {
                    title: qsTr("Portfolio")+Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        _app.dropSymbols(1); // Drop Req for Tadawul
                        lightTimer.stop();
                        _app.CreatePortfolio(1, translate.text);
                    }
                    imageSource: "asset:///images/portfolio_title_icon.png"

                },
                ActionItem {
                    title: qsTr( "News Feeds")+Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        _app.dropSymbols(1); // Drop Req for Tadawul
                        lightTimer.stop();
                        var feeds = newsFeeds.createObject();
                        feeds.navId = {
                            'id': navTab,
                            'langSettings': translate.text
                        }
                        navTab.push(feeds);
                    }
                    imageSource: "asset:///images/news_feed_icon.png"

                },
                ActionItem {
                    title: qsTr("Language")+ Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        //_app.ChangeAppLanguage();
                        var go = langsettings.createObject();
                        go.lang = {
                            'lang': _app.getCurrentLocale()
                        }
                        go.setLanguage(_app.getCurrentLocale());
                        navTab.push(go);
                        //_app.changeOrientation();
                    }
                    imageSource: "asset:///images/language_icon.png"
                },
               /* ActionItem {
                    title: qsTr("Support") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        invoke.query.setUri("pin:2ADAEE2D")
                        invoke.trigger("bb.action.INVITEBBM")
                    }//InvokeActionItem
                    imageSource: "asset:///images/support_icon.png"
                },*/
                InvokeActionItem {
                    id:supportBBM          
                    title: qsTr("Support") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.OnBar

                    imageSource: "asset:///images/support_icon.png"
                    query {
                        invokeActionId: "bb.action.INVITEBBM"
                        uri: "pin:2ADAEE2D"
                    }
                },

                InvokeActionItem {
                    id:shareBB
                    title: qsTr("Share to Friends") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.OnBar

                    query {
                        mimeType: "text/plain"
                        // invokeTargetId: "sys.bbm.sharahandler"
                        invokeActionId: "bb.action.SHARE"
                    }
                    onTriggered: {

                        data = "Hi I am using Trading App, you can download it form the link http://appworld.blackberry.com/webstore/?&lid=in:bb:apps&lpos=in:bb:apps&countrycode=IN&lang=en!";
                    }
                },
                ActionItem {
                    title: qsTr("Subscription") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        _app.getSubscriptionStatus(1);
                    }
                    imageSource: "asset:///images/status_icon.png"
                },
                ActionItem {
                    title: qsTr("About mTadawul") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        var about= mTadawulNote.createObject();

                        about.navId = {
                            'id': navTab
                        }
                        navTab.push(about);

                    }
                    imageSource: "asset:///images/about_icon.png"
                },

                ActionItem {
                    title: qsTr("Exit Application") + Retranslate.onLanguageChanged
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        _app.exitApp();
                    }
                    imageSource: "asset:///images/app_exit.png"
                }

            ]

我在更改为“英语到阿拉伯语”后显示上面qml的阿拉伯语标题。但它不适用于InvokeActionItem。为什么?我错过了什么?

请帮忙, 感谢!!!

1 个答案:

答案 0 :(得分:0)

根据InvokeActionItem中查询的特殊性,它可能会导致菜单中的0到多个项目。我猜,但有可能因为这样,+ Retranslate.onLanguageChanged的行为没有被提升到系统为你构建的终极UI对象。

另一种可能性是,由于同样的原因,翻译系统无法为这些对象找到合适的语言字符串。