WPF:本地化 WPF 功能区 QAT 上下文菜单文本
我正在使用 .NET 4.0 WPF 功能区,并正在寻找一种本地化功能区上下文菜单字符串的方法。默认情况下,右键单击功能区会显示“最小化功能区”等项目。我想本地化这些字符串,例如显示“Multifunktionsleiste verbergen”。
我该怎么做呢?这有可能吗?
I'm playing with the .NET 4.0 WPF ribbon and am looking for a way to localize the Ribbon context menu strings. By default, right clicking the ribbon shows items like "Minimize the Ribbon". I'd like to localize these strings to for example display "Multifunktionsleiste verbergen".
How would I do that? Is this possible at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
(希望)对 userxyz 解决方案的完整扩展:
A (hopefully) complete extension to userxyz's solution:
我不确定,但如果不从源重新编译库,这是不可能的(如果我不正确,那么从某人这里来会很棒),因为功能区库定义了 ResourcesManager
如果您要更改源,则这些文本存储在名为 ExceptionStringTable 的资源文件中。 TXT。
字符串的标识符为:
库源可以从 此处。在 RibbonControlsLibrary\Resources\ 中,您可以找到 Ribbon 资源的实现。
I am not sure but it cannot be possible without recompling library from sources (If I am not correct it would be great to here from someone) as the ribbon library defines ResourcesManager
If you are changing source those texts are stored in resources file called ExceptionStringTable.txt.
The identifiers for strings are:
Sources for library can be downloaded from here. In RibbonControlsLibrary\Resources\ you can found the implementation of resources for Ribbon.
另一种方法是通过反射替换值:
必须在第一次使用功能区控件(通常是主窗口的 InitializeComponent)之前执行此代码
Another approach would be to replace the values by reflection:
This code has to be executed before the first usage of the ribbon control (typically InitializeComponent of the main window)
我想建议基于之前讨论的另一种解决方案:
其中 RibbonReourceManager 是基本 ResourceManager 的继承者,具有重写的 GetString 方法。并且
RibbonResourceManager
应返回下面列出的所有字符串:I would like to suggest another one solution based on previously discussed:
where
RibbonReourceManager
is inheritor of the basic ResourceManager with overridden GetString methods. AndRibbonResourceManager
should return all strings listed below: