Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am working on multi language C# project. I have all the neceesary setup for handling multi language in my project and its working fine.

Question i have, is there any way i can know, there is a missing key-value string in my non-default language resource(e.g. SPANISH as english is deafult for me).

e.g.

English
* CodeStr = CODE
* NameStr = NAME

Spanish
* CodeStr = CODE

In above example, Spanish doesn't have NameStr key in it and because of it, application goes to default English language to get the value for NameStr. Is there any i can detect there is missing key in my non-deafult language.
Posted

I think you should be able to use the ResourceManager.ResourceSets[^] field to get a hashtable of the ResourceSet[^] objects for each culture. Each ResourceSet object has a hashtable containing all of the resources for that culture. I would try scanning through each of those and comparing the keys. The Except()[^] method from LINQ should make that comparison easy.
 
Share this answer
 
We use Zeta Resource Editor for our string resources. It shows the resource keys and their corresponding values of all the languages in a big grid, and by simple alphabetic sorting of the values of a language, the missing values will show up on top.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900