Reputation: 4443
I have a multilanguage application and customer wants to edit Resources.resx files like he wants. I created silverlight project and add some files:
They all have build action "Embedded Resource"
Everything is working but Those files are embeded to XAP file. And customer cannot edit them.
My resource manager i get like that:
private static ResourceManager manager;
public static ResourceManager Manager
{
get
{
if (manager == null)
manager = new ResourceManager("Project.Resources", Assembly.GetExecutingAssembly());
return manager;
}
}
How can i get this resources from some folder and not build them to .xap file ???
Upvotes: 2
Views: 2737
Reputation: 93551
As this is a string localisation problem only, and you just want the flexibility of selecting an entire set of localised content, there are several methods out there for binding your strings to a resource manager. Most of them are overly complex for the desired result:
Given the following:
A far simpler approach is to simply place your strings, as name value pairs, in the global App dictionary and reference them via a short/simple StaticResource binding e.g.
Text={StaticResource L_MenuHome}
The remaining problem is then just how to get another set of language strings into the App dictionary (which is actually quite easy):
I don't know why everyone seems to love the really complex solutions when StaticResources do the job just fine and with a lot less effort. We also tend to use a webservice to fetch a set of language strings from a database as it is generally less than 200K and databases are far more flexible for updates.
Anyway, just trying to put some commonsense back into localisation. It works for us. Feel free to use, ignore, suggest improvements etc.
Hope this helps.
Upvotes: 2
Reputation: 8421
You could try downloading the appropriate file and storing it in your isolated storage and try reading it from there. you could do this on application startup
Since you only have strings in your resx i would suggest that you copy your resource items into a simple text with some predefined format and reading it from there. Let me know if you need help on any specific implementation details.
Upvotes: 1