将DocumentViewer的语言设置为德语(来自代码,而不是XAML) [英] Set language of the DocumentViewer to German (from code, not XAML)

查看:119
本文介绍了将DocumentViewer的语言设置为德语(来自代码,而不是XAML)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 DocumentViewer 的语言从默认英语更改为德语但没有成功。



作为WPF的新手,我真的很难做到这一点。



重要提示: DocumentViewer 是在代码后面创建的,响应菜单项单击,然后它被添加为主窗口的内容



我尝试过以下操作,但似乎什么都不做:

I am trying to change the language of the DocumentViewer from default English to German but with no success.

Being new to WPF, I really struggle to do this.

IMPORTANT: DocumentViewer is created in code behind, in response to the menu item click, and then it is added as main window's Content.

I have tried doing the following, but it seems to do nothing:

myDocumentViewer.Language = System.Windows.Markup.XmlLanguage.GetLanguage("de-DE");



没有更改, DocumentViewer 保留英语。



谷歌搜索正确使用语言属性,我发现没什么用处。



问题:



如何设置 DocumentViewer 的语言(使用代码创建) to German?


No changes are made, DocumentViewer keeps English.

Googling for proper usage of the Language property, I found nothing useful.

QUESTION:

How can I set the language of the DocumentViewer (created with code) to German?

推荐答案

我评论了这个问题并问:
I commented the question and asked:

我是不敢问,但是你不期望改变语言标签会奇迹般地导致英语工具提示自动翻译成德语吗?

I'm afraid to ask, but don't you expect that changing of the language tag will somehow miraculously cause automatic translation of English tooltips into German?

AlwaysLearningNewStuff finally回复:
AlwaysLearningNewStuff finally replied:



是的!这不是xml:lang和语言的文档吗?



如果你把它设置为de-DE,那么语言从默认的英语变为德语,然后工具提示应该从英语改为德语,对吗?


Yes! Isn't that what documentation for xml:lang and Language states?

If you set it to "de-DE" then Language changes from default English to German, then tooltips should change from English to German, right?

当然不是。它不只是不,它当然不是。



请阅读我最后的评论,其中我谈到了引力恶魔。如果您认为计算机内部有一些恶魔将任意文本或工具提示翻译成标准文化信息集中列出的一种语言,请不要屏住呼吸。这种想法通常会产生反作用,与您试图引用的WPF知识无关。更好地了解任何自动翻译工具。我对英语和德语等密切语言之间的翻译不太确定,但其他语言之间的翻译是笑话的无限来源。在语言科学和技术的现代水平上,这只能是一个很好的翻译助手,而不是翻译......



很抱歉给您带来不便。 :-)



-SA

Of course not. It's not just "not", it's "of course not".

Please read my last comment where I talked about "gravitation demons". If you think that there are some demons inside a computer who translate any arbitrary text, tooltip or not, into one of the languages listed in the standard set of culture info, don't hold your breath. This thinking is in general counter productive and has nothing to do with your knowledge of WPF you are trying to refer to. Better look at any automatic translation tool. I'm less sure about translations between such close languages as English and German, but translation between some other languages is the infinite source of jokes. At the modern level of linguistic science and technology, this can only be a good translation assistant, never a translator…

Sorry for the inconvenience. :-)

—SA


这篇关于将DocumentViewer的语言设置为德语(来自代码,而不是XAML)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆