<tfoot id='RKRw9'></tfoot>

      • <bdo id='RKRw9'></bdo><ul id='RKRw9'></ul>
      <legend id='RKRw9'><style id='RKRw9'><dir id='RKRw9'><q id='RKRw9'></q></dir></style></legend>

      1. <small id='RKRw9'></small><noframes id='RKRw9'>

        <i id='RKRw9'><tr id='RKRw9'><dt id='RKRw9'><q id='RKRw9'><span id='RKRw9'><b id='RKRw9'><form id='RKRw9'><ins id='RKRw9'></ins><ul id='RKRw9'></ul><sub id='RKRw9'></sub></form><legend id='RKRw9'></legend><bdo id='RKRw9'><pre id='RKRw9'><center id='RKRw9'></center></pre></bdo></b><th id='RKRw9'></th></span></q></dt></tr></i><div id='RKRw9'><tfoot id='RKRw9'></tfoot><dl id='RKRw9'><fieldset id='RKRw9'></fieldset></dl></div>

      2. C# 以编程方式更改应用程序语言 UWP 实时

        C# change app language programmatically UWP realtime(C# 以编程方式更改应用程序语言 UWP 实时)
        <legend id='t1y0j'><style id='t1y0j'><dir id='t1y0j'><q id='t1y0j'></q></dir></style></legend>

        <tfoot id='t1y0j'></tfoot>

          <tbody id='t1y0j'></tbody>

            <bdo id='t1y0j'></bdo><ul id='t1y0j'></ul>
          • <i id='t1y0j'><tr id='t1y0j'><dt id='t1y0j'><q id='t1y0j'><span id='t1y0j'><b id='t1y0j'><form id='t1y0j'><ins id='t1y0j'></ins><ul id='t1y0j'></ul><sub id='t1y0j'></sub></form><legend id='t1y0j'></legend><bdo id='t1y0j'><pre id='t1y0j'><center id='t1y0j'></center></pre></bdo></b><th id='t1y0j'></th></span></q></dt></tr></i><div id='t1y0j'><tfoot id='t1y0j'></tfoot><dl id='t1y0j'><fieldset id='t1y0j'></fieldset></dl></div>

                  <small id='t1y0j'></small><noframes id='t1y0j'>

                1. 本文介绍了C# 以编程方式更改应用程序语言 UWP 实时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的应用程序中,每种语言的字符串资源都是单独存储的,并根据语言环境的类型显示.我想更改应用程序设置中的语言.如何实现语言选择后立即应用到用户界面?

                  In my application for each language string resources are stored separately and are displayed depending of type of language environment. I want to change the language in the application settings. How do I realize that after the language selection instantly apply it in the user interface?

                  推荐答案

                  我们可以使用 ApplicationLanguages.PrimaryLanguageOverride 在运行时更改语言而无需重新启动应用程序.

                  We can use ApplicationLanguages.PrimaryLanguageOverride to change the language during runtime without restart the app.

                  例如:我支持en"和fr"两种语言,本地化消息将显示在文本块中.

                  For example: I have two languages supported "en" and "fr", localized message will show up in textblock.

                  1. 使用 Windows.Globalization 添加;

                  1. Add using Windows.Globalization;

                  将默认语言从en"更改为fr"

                  Change the default language from "en" to "fr" by

                  ApplicationLanguages.PrimaryLanguageOverride = "fr";
                  

                2. 重新导航到当前页面以刷新 UI.

                3. Re-navigate to the current page to refresh the UI.

                  Frame.Navigate(this.GetType());
                  

                4. 请注意,您需要将 PrimaryLanguageOverride 与系统文化进行比较以设置下次应用启动的语言,因为 PrimaryLanguageOverride 设置是持久的.如果您启用了页面缓存,当您动态应用不同的语言时,您需要先设置 Frame.CacheSize = 0; 来清除缓存,然后再将其设置回来.

                  Note that, you need to compare the PrimaryLanguageOverride with the system culture to set the language for next app launch, because the PrimaryLanguageOverride setting is persisted. And if you have page cache enabled, when you apply a different language on the fly, you need to clear the cache by setting Frame.CacheSize = 0; first then set it back.

                  这篇关于C# 以编程方式更改应用程序语言 UWP 实时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)

                    <tfoot id='c3jLv'></tfoot>
                    <i id='c3jLv'><tr id='c3jLv'><dt id='c3jLv'><q id='c3jLv'><span id='c3jLv'><b id='c3jLv'><form id='c3jLv'><ins id='c3jLv'></ins><ul id='c3jLv'></ul><sub id='c3jLv'></sub></form><legend id='c3jLv'></legend><bdo id='c3jLv'><pre id='c3jLv'><center id='c3jLv'></center></pre></bdo></b><th id='c3jLv'></th></span></q></dt></tr></i><div id='c3jLv'><tfoot id='c3jLv'></tfoot><dl id='c3jLv'><fieldset id='c3jLv'></fieldset></dl></div>
                        <tbody id='c3jLv'></tbody>

                      <small id='c3jLv'></small><noframes id='c3jLv'>

                        <bdo id='c3jLv'></bdo><ul id='c3jLv'></ul>
                        <legend id='c3jLv'><style id='c3jLv'><dir id='c3jLv'><q id='c3jLv'></q></dir></style></legend>