Localization/Globalization is pretty easy in Visual Studio using RESX files. I just add a resource file, like MyTextSnippets.resx
, add key/value pairs, and create copies for every language I'd like to support like MyTextSnippets.de.resx
, MyTextSnippets.fr.resx
etc.
Now think of longer texts, where the String resource editor grid doesn't work very well. No problem, just choose "Add Resource | Add New Text File" from the designer, and you can edit as many text files as you want. Example: I add MyTemplates.resx
, and to this RESX I add a file called SomeEmailTemplate.txt
. Works fine so far, however when a create a copy of the resx file, say MyTemplates.de.resx
, and open SomeEmailTemplate.txt
from there, it will open always the same file. If you look at the details, the text file will not be embedded in the resx container, but it is created in a global folder "Resources", and the resx files just hold a reference, all to the same file.
I can't figure out how to localize it. Any idea?
Of course, I could embed add a text file for every language, and at runtime, enumerate the available text files and try to find the best match for UI culture of the current thread. However this doesn't feel right, as all that magic is available out of the box for strings and designer properties.