Hallaghan
Hallaghan

Reputation: 1941

Automated MVC App Localization

The company for which I work for has built a large ASP.NET MVC application last year and it wasn't prepared to support Localization to begin with as the main goal of this application was to serve portuguese clients. But as the application took greater proportions, the demands were that it should support other languages, like english for instance. I was asked to implement localization for it. I did some research about how resource files are added. But I need a sort of automated localization, maybe a way of having resource files automatically generated for each view, getting the content that needs to be localized. I've already made up an excel file with every string in the application and its translation to the languages required. How could I go about this?

Upvotes: 2

Views: 866

Answers (2)

Asbjørn Ulsberg
Asbjørn Ulsberg

Reputation: 8820

It is possible to have what you're now stuck with in Excel exported as the appropriate .resx files. There are many ways to do this, depending on your version of Excel. If you're up for (more) manual labor, you can just create the required .resx files in Visual Studio and do some copy and pasting.

Having .resx files automatically generated from a view requires some kind of tooling. There are Visual Studio add-ins that will do this for you; Resource Refactoring Tool is one of them (I think ReSharper has similar capabilities too). Extracting texts to resources automatically would be a bit impractical and would lead to resource keys that are automatically generated and not very intelligible. Doing this manually will yield the best result.

When you're extracting text fragments to resources, I can recommend that you put all .resx files into a separate assembly so the resource texts can be used across several assemblies, in error messages, exceptions, etc. This requires them to be global, of course.

Upvotes: 2

Christoph Lupprich
Christoph Lupprich

Reputation: 1190

I think this tool could help you. There seems also to be another one, but the page is currently offline.

Upvotes: 1

Related Questions