本文介绍了从通用应用程序中读取设备的一致语言读数的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我正在与前一天写的一个班级写作。但是在Windows / Phone上拉动语言和区域之后,我得到了不一致的Uri结果?!

I am working against a Class a wrote the other day. But I get unconsistent Uri results after pulling language and region on windows/Phone?!

作为这一切的初学者,很多人都可以告诉我发生了什么;

As a beginner to all this, great of someone could tell me whats going on;

public void SetLanguageCode()
        {
         
            GeographicRegion userRegion = new GeographicRegion();
            string LocalLanguageString = userRegion.CodeTwoLetter;

            string LocalLanguage = Windows.Globalization.Language.CurrentInputMethodLanguageTag;
            // string for NavigationUrl
            string LocalLanguageID = LocalLanguage + "-" + LocalLanguageString;
            Uri TestUriBase = new Uri("http://test.test.com/");
            Uri UserUri = new Uri(TestUriBase, LocalLanguageID);

            UriBuilder UrlBuild = new UriBuilder(UserUri);
            Uri UriFinal = UrlBuild.Uri;
            _languageCode = UriFinal.ToString();
        }

最后一个字段_languageCode返回"buggy" Uri在某些地区/设备上。你怎么能给它提供比上面更静态/可靠的语言阅读?

Last field _languageCode returns "buggy" Uri on some regions/devices. How could you feed it a more static/solid language reading than above?

再次感谢任何指针......

Thanks again for any pointers...

问候,加藤。

推荐答案

你的意思是什么?"buggy" Uri,我测试了你的代码,目前我的地区是美国,语言是en-us,我的结果是"",这是正确的吗?

What do you mean "buggy" Uri, I tested with your code and currently my region is US and language is en-us, my result is "http://test.test.com/en-US-US", is this correct?

不确定您的预期结果是什么?你能告诉我有关这方面的更多错误行为以及如何重新解决你的问题。

Not sure what is your expected result? Could you tell more buggy behavior about this and how can I repro your issue.

- 詹姆斯


这篇关于从通用应用程序中读取设备的一致语言读数的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 00:55