WPF - 实现多语言应用程序 - 绑定问题
你好 我必须在我的应用程序中添加对其他语言的支持。几乎整个应用程序都已准备就绪,但是我在翻译从 resourcesDictioanry 文件“加载”的工具提示时遇到问题。 对于我的应用程序中的几个元素,我有相同的工具提示。因此,我决定将工具提示放入 ResourceDitionary 中,而不是一遍又一遍地编写相同的代码。 我的工具提示看起来像这样
<TextBlock FontWeight="Bold" Text="Text to translation" TextAlignment="Left" />
<TextBlock Text="{Binding Path=_Code}" Grid.Column="1" TextWrapping="Wrap"/>
<TextBlock FontWeight="Bold" Text="Text to translation" TextAlignment="Left" Grid.Row="1" />
<TextBlock Text="{Binding Path=_Name}" Grid.Column="1" Grid.Row="1" TextWrapping="Wrap"/>
<TextBlock Text="Text to translation:" Grid.Row="3" FontWeight="Bold" TextAlignment="Left" />
</Grid>
</ToolTip>
从 ResourcesDictionary 实现多语言支持的最佳方法是什么?
Hi
I have to add support for other languages in my application. Almost entire application is ready however I have a problem with translating a tooltip which is 'loaded' from resourcesDictioanry file.
For couple element in my application I have the same tooltip. So instead of writting the same code over and over again I decied to put a tooltip into ResourceDitionary.
My tooltip looks like that
<TextBlock FontWeight="Bold" Text="Text to translation" TextAlignment="Left" />
<TextBlock Text="{Binding Path=_Code}" Grid.Column="1" TextWrapping="Wrap"/>
<TextBlock FontWeight="Bold" Text="Text to translation" TextAlignment="Left" Grid.Row="1" />
<TextBlock Text="{Binding Path=_Name}" Grid.Column="1" Grid.Row="1" TextWrapping="Wrap"/>
<TextBlock Text="Text to translation:" Grid.Row="3" FontWeight="Bold" TextAlignment="Left" />
</Grid>
</ToolTip>
What is the best way to implement multilanguage support from ResourcesDictionary ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,您也许应该替换
为
This recipy 假设您的应用程序的翻译是基于资源字典的。
You should perhaps substitute
by
This recipy assumes your application's translation is resource dictionary-based, of course.