开发者

Preload translations from database before Silverlight is loaded

We are storing localization strings in database. Localization is needed for multi language application that we are building. Data layer is behind WCF service, and all data is comming throu this WCF channel.

We need to load translations before Slivlerlight 开发者_如何学Pythonapplication shows up in user browser. So preloading data with this is most logical path to go. But Silverlight asynchronous calls are giving me hard time to load translation strings from database, because result is loaded afer the Silverlight loads.

Is there a way to solve this problem ?


I see two solutions to the problem:

  1. If you really want to load data even before the Silverlight application shows up in the browser then the only way to do it is passing the data before Silverlight is embeded. In this case you could use AJAX to fetch the data and then dynamically add the SL object to the DOM passing on parameters. This is quite a hassle to do though in my opinion.
  2. How about hiding your application (making the main Grid or container to Visiblilty="Collapsed") until the SL app fetches the data. Set a timer to dynamically check for wether the data has loaded and zoom, there you have it.


I`ve found that loading directly from database is not right way to solve localization - translation problem. Translations are something that not change too offten so Im using XML file to store translations. This XML file is embedded resource, and it is generated from database every time when new translations are added.

This way I have no longer troubles loading data width asynchronous calls.

Thanks for the answer...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜