魅力酒吧与语言问题 [英] Charm bar with language issue
问题描述
我使用覆盖功能从"en-us"更改应用程序语言后到"zh-tw",并调用"WinJS.Resources.processAll()",除魅力设置视图外,一切正常,我的意思是设置列表视图。我真的动态设置每个设置的标题:
var account = WinJS.Resources.getString(" account");
WinJS.Application.onsettings = function(e){
e.detail.applicationcommands = {
          "帐户":{title:account.value,href:" /pages/settings/account/account.html" },b
$
      };
      WinJS.UI.SettingsFlyout.populateSettings(e);
};
有谁知道如何重新加载此魅力设置视图,或其他方式使其正确显示?
您必须拥有特定于语言的资源文件。
因此,在您的解决方案中,创建一个文件夹"strings"。为您支持的语言创建子文件夹,例如"en-US"。然后创建一个文件"resources.resjson"。在每个语言文件夹中。
按以下格式放置键:值:在每个文件中。确保每个文件夹中的文件名相同,文件中的密钥也一样。
{
" Key1":" Value1",
""Key2":" Value2"
}
在清单文件中设置默认语言到您想要的那个,例如en-US。
然后在您的代码中将行更改为:
" Account":{title:
WinJS.Resources.getString(" Key1")。value ,href:"pages/settings/account/account.html" },
运行应用程序。然后
转到控制面板 - >所有控制面板项目 - >语言。
确保所需的语言位于顶部。
重新启动应用程序(不是必须确定的....你应该能够看到变化。
希望有所帮助
After I use override function to change the application language from "en-us" to "zh-tw", and call "WinJS.Resources.processAll()", everything is OK except charm setting view, I mean the setting list view. I really dynamically set the title of each settings:
var account = WinJS.Resources.getString("account");WinJS.Application.onsettings = function (e) {
e.detail.applicationcommands = {
"Account": { title: account.value, href: "/pages/settings/account/account.html" },
};
WinJS.UI.SettingsFlyout.populateSettings(e);
};
Is anyone know how to reload this charm setting view, or other way to make it correctly shown?
You must have language specific resource files .
So in your solution create a folder "strings" create sub folders for the languages you are supporting like "en-US". Then create a file "resources.resjson" in each language folder.
Put the keys : values in the following format: in each of the file. Make sure filename is same in each folder and keys in the files are same as well.
{
"Key1": "Value1",
"Key2":"Value2"}
In the manifest file set the default Language to your desired one, e.g en-US.
And then in your code change the line as:
"Account": { title: WinJS.Resources.getString("Key1").value, href: "/pages/settings/account/account.html" },
Run the app. and then
Go to control panel -> All control Panel Items -> Language.
Make sure the language which is the desired one is at the top.
restart the app (not a must for sure).... you should be able to see the changes.
Hope it helps
这篇关于魅力酒吧与语言问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!