Search code examples
wpflocalizationinternationalizationresourcedictionary

Is it possible to set multiple values (one for each language) in WPF ResourceDictionary (.resx) containing localization strings?


After reading the very nice Globalization tutorial for WPF in CodeProject, I plan to apply the same technique in my own projects.

The tutorial shows how to create a Strings.resx containing named strings for some default language, and advises to DUPLICATE the whole .resx file, adding some localization code to the filename, and translating the strings to the target language.

That way, Strings.resx would contain a register named name_entry_label with value Write your name, and the same-named register in Strings.pt-BR.resx would have the value Escreva seu nome, and so on for any additional language.

The problem I found is: if you ADD a register in one of the resource files, the others don't update. They require the entries to be manually controlled, which is dumb, repetitive and error-prone.

The most logical way to do that, in my point of view, would be to have a table resource dictionary, where each name would contain one value per column, and each column would correspond to a given language. Other way would be that each resx file would be a view of a "master" one, which would keep the views in sync. I am not aware if it's possible to get any of these behaviours, though.

Any help on how to get the described behavior (records always in sync between different lenguage resources) is much appreciated, thanks for reading.


Solution

  • Just to improve visibility I'll post hbarck's link here:

    resx Manager Tool at CodePlex

    It is a very lightweight and straightforward app that creates an XML with your project's resx files, and puts them in a nice Excel file with each language in a column, and a sheet for each sub-project's files.

    Warning: when opening the file in Excel, say YES to "open anyway" dialog. When saving say NO to "convert?" dialog (keep Excel XML 2003 format or you will have a hard time getting your translations back to your project).

    For instructions see the documentation at CodePlex. If you have any problem, don't come crying to me, I'm just posting the link :-P

    Hope this helps someone else too!