Silverlight本地化的最佳做法? [英] Best Practices For Silverlight Localization?

查看:70
本文介绍了Silverlight本地化的最佳做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人在Silverlight中具有任何最佳实践或本地化经验. MSDN建议将资源绑定到XAML,但结果很混乱:

Does anyone have any best practices or experience of localization in Silverlight. MSDN recommends binding the resource to the XAML, but the result is pretty messy:

<TextBlock Text="{Binding Path=Resource1.HelloText, Source={StaticResource LocalizedStrings }}"/>

其中的一页将使XAML不可读!

A page of that is going to make the XAML unreadable!

有快捷键吗?

推荐答案

我不久前问了一个类似但更复杂的问题(

I asked a similar but more complex question a while back (silverlight paramterised resource values for internationalisation)

在MSDN上给出的示例确实不足以进行严格的本地化,它假定每个字符串都完全存在并且没有参数,事实是您将拥有希望嵌入在字符串中的值,但需要使用占位符来标记该字符串的位置字符串中的变量,以便翻译人员可以在翻译时移动标记.

The example given on MSDN is really insufficient for serious localization, it assumes every string is entirely present and has no parameters, the reality is you will have values you wish to embed within the string but need placeholder to mark the location of that variable in the string so a translator can move the marker as they translate.

您可以通过将自己实现多重绑定到Silverlight中来实现更高级的机制-Colin Eberhardt做了很好的实现(

You can achieve a more advanced mechanism by implementing multi-binding yourself into silverlight - Colin Eberhardt did a nice implementation (silverlight multibindings how to attached mutiple bindings to a single property) - adjusted a bit and combined with a MultiValue Converter you can perform multiple bindings, allowing the first binding to be to the language file, and subsequent bindings to be to the parameters to be embedded.

这是很痛苦的,但是本地化的故事却明显缺乏-即使通过Silverlight 3/4在PDC09上聊天,目前实际上也没有一条很好的途径-如果WPF多重绑定使它延伸到SL4,这会使它略微更容易,但是我还没有看到一个很好的替代实现,除了人们从ViewModel输出所有字符串之外-从设计者"的角度看这似乎是错误的.

It's quite a pain but the localization story is just noticably lacking - even chatting at the PDC09 over silverlight 3 / 4 there is really not a great route at present in place - if WPF multibinding makes it across to SL4 that makes it slightly easier, but I havn't seen a good alternative implementation as yet except for people outputting all the strings from the ViewModel - which seems wrong form the 'designers' perspective.

这篇关于Silverlight本地化的最佳做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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