Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best alternatives to using Resource files in .net site

In the past I have used asp.net's built in Resource files for handling localization. It's worked pretty well and we find it easy to use and maintain in our business.

There is one big drawback though - our client's support teams can't update the resource files themselves. We have a big project starting soon and the option to allow the external support team manage localization is a main requirement. Up until now we have had clients just contact us, we get the piece translated and then roll the updated resx file to the live server.

I know that updating a resx file causes the application to recompile and I don't like the idea of allowing non techies download and mess around with a resx file (not to mention having the site uncompiled in a live environment) so I'm wondering if there are any other options available to us other than going down the database route?

If we do have to build this type of localization functionality into a few database tables, does anyone have any good templates for starting off?

Not sure if it helps knowing or not but the site we're talking about building here would be localized into about 15 different languages including chineese and arabic. The translations would be applied onto the aspx pages and in the XML that would leave our system to third parties.

like image 952
Richard Reddy Avatar asked May 17 '11 16:05

Richard Reddy


2 Answers

Whatever you do, you will probably need to write custom ResourceProvider.

You may think of using XML as a source for your localizable resources - in that case you can use uncompiled resx files, but I guess that is what you are complaining about. Otherwise, you can use bundle files, similar to Java properties, I mean plain text file with key=value pairs. That should be very easy to edit.

like image 103
Paweł Dyda Avatar answered Sep 25 '22 02:09

Paweł Dyda


Sure - use a config file. This is basically an XML file.

<messages locale="DE">
    <message id="FileNotFound" Value="Die Datei wird nicht gefunden" />
    <message id="FatalErr" Value="Es ist ein schwerwiegender Fehler gewesen. Das Programm muss beendet." />
    ...
</messages>

You can have one file for each language, or combine them in one file.

like image 20
Allan W Avatar answered Sep 24 '22 02:09

Allan W