Reputation: 32391
I have many resource files, in many different languages.
Lets suppose for example we are supporting 3 languages (en, de, fr), and have this file:
common.resx common.de.resx common.fr.resx
I would like to detect occurrences when for instance a resource is requested in de, but is missing and so reverts to the default language. Is there any way of catching this? (so I can log it and later add the missing resource).
Thanks
Upvotes: 7
Views: 1432
Reputation: 23289
Resharper has this great feature http://www.jetbrains.com/resharper/features/internationalization.html#Code_Inspections_for_Resource_Files
ReSharper warns you whenever a specific resource value is not overridden in a specific culture
Upvotes: 1
Reputation: 16680
Assuming that all resource file changes start in development and make their way to production, this seems like a job for some form of static analysis.
I use Zeta Resource Editor because it highlights areas that are missing translations and also placeholders (e.g. {0}).
Upvotes: 2
Reputation: 26532
If you want to catch the differences use RESX Synchronizer. It is an open source app that can synchornize all differences from main resx to localized one (it adds and/or removes keys in the localized resource).
You can use it as follows to copy all changes from common.resx to common.de.resx:
resxsync /v common.resx common.de.resx
The /v option list all changes that is all keys that were added to or removed from the de resx.
Upvotes: 5
Reputation: 20992
There's nothing in the existing resource reading API that exposes fallbacks externally. However, System.Resources.ResourceManager is not sealed, so there's nothing stopping you from subclassing it to raise an event when fallback is required.
Upvotes: 0