C# – Change the “(default)” ResX language in a C# app

clocalizationnetresx

I'm making an app in C#, with a lot of forms and other stuff.
I wanted to localize it, so I used the integrated localization functions in VS.
The app was originally in French (cause I am) with English translation RESXes, but now that it is on Codeplex with some other developers who doesn't speak french, I want to change the "default" language in the app and the RESX files so they can translate to other languages without reading French.
Cause when you choose another language in VS Form Designer, it shows the default language (here, French). I tried to rename all the files, but the problem is all the form properties are stored in the default RESX, the French one, so if I rename, it will break all the stuff. Is it possible to change the default language to English?

EDIT: I think I need to be more precise.
The app is originally in French. Then I localized it in English. There is now a MainWindow.resx that contains form properties + original french localization and a MainWindow.en-US.resx that contains ONLY english localization. So if in the Designer, in "Language" I choose "(default)" it shows me the MainWindow.resx FRENCH, and if I want to translate, It shows me the French texts. To make the translation more easy for the other developers, I want to make the MainWindow.resx ENGLISH localization and create a seperate MainWindow.fr-FR.resx. I also tried to change "Neutral Language" in AssemblyInfo.cs, no effect.

Best Answer

While you could do renames in file system to achieve neutral culture/resource change, you need to update project file as well, which is cumbersome. I found the simplest way was to do this via Visual studio extension named ResXManager.

Steps in detail:

1. Run & configure ResXManager

In VS: Tools -> ResXManager.

  1. Choose configuration tab (below)
    1. Disable option "Confirm adding new resource files". Otherwise you would have to click later per each file to accept its creation.
    2. Set Neutral Resource language so it would show up with a correct flag for your viewing pleasure.
  2. Switch back to main tab where you see all solution resources with translations side-by-side.

2. Extract neutral culture resources as explicitly French

  1. Adda a new column for French using the "Add new language" button in the toolbar.
  2. Copy all French resources from existing neutral language column (CTRL-SHIFT-DOWN helps top select full column)
  3. Paste all resources to new French column.

Note that ResXManager will create new resx files for you and add them to project file.

3. Set neutral culture reousrces to English ones

  1. Copy all English resources from specific culture column
  2. Paste all resources to Neutral culture column

4. Inform .Net that neutral culture is now english

[assembly: NeutralResourcesLanguage("en-GB", UltimateResourceFallbackLocation.MainAssembly)]

5. Remove explicit English resx files.

Since the neutral resx files now already contain english resources then you don't need to keep them the culture-specific ones. Unfortunately ResXManager didn't seem to have a button for this but you can I chose to use VS solution manager filter "en-GB.resx" and deleted all files it found. Again, doing it within VS automatically updates your project file.

All done.