Localization of ASP.Net (satellite assemblies and DB with custom ResourceProvider)

I am looking for the best solution to easily add new languages ​​to asp.net without deploying / creating an existing code base.

From what I researched, it seems that you can collect resource files on the fly in satellite assemblies, but I'm not sure how to get the application to use these DLLs after generation?

Another option I've seen is to save translations in the database and write your own ResourceProvider so that you can use the built-in localization methods, while abstracting the actual implementation (in this case, the database).

In any case, the front end for this site will be the same (meta: resourcekey for controls, etc.).

But I'm struggling to decide which approach is the easiest to support. For example, does the new Satellite Assembly publish a restart of the application pool, or is everything beautifully beautiful?

EDIT

Translation will be provided by a third-party API, so the quality of a person’s service does not matter. I thought I would add this because of the answers received.

+7
source share
2 answers

With Asp.Net (currently) you do not need to compile yourself, you can simply deploy the resx files (to the App_LocalResources or App_GlobalResources folder), and Asp.Net will take care of compiling them into Satellite Assemblies. That's cool.

With the Database approach, you risk synchronization problems: how do you know if a given resource string is being translated? In addition, fixing them is not so simple (for translators / localization engineers). And you still need to prepare a “install” script. If this is what you are going to give translators, good luck. You will encounter a large number of redistributions, and you will have to fix them (manually?).

Resx files (being simple XML) are a little easier to verify (it is either valid XML in terms of a given XSD or not). In addition, this is a standard technology, you will not need to implement anything yourself. Therefore, I would recommend it.


EDIT

Another problem with database-driven resources may be character encoding. You will need to create your own set of translations. My experience is that the result can be in several different encodings. Especially if you want to use a text file. On the other hand, the standard encoding of XML files is UTF-8 ...

+2
source

Resx

Having about 30+ languages ​​in a Windows Forms and Web Forms application ( this one , if I am allowed to post a link) Finally, I have been most successful in simple .resx files in App_LocalResources .

What I discovered was that compilation was extremely slow in VS.NET, so I made a slightly modified approach:

  • Only have English RESX files in VS.NET solution.
  • Create a shadow website structure with only App_LocalResources for all languages, including English, in a separate folder not visible to VS.NET.
  • Write a simple CMD script to copy real English resources to a separate folder.
  • Use the free Zeta Resource Editor tool to actually transfer it to a separate folder.
  • Have a publishing script that copies real web files (e.g. ASPX, ASAX, MASTER, etc.) to a website, and also copies resources to websites.

This approach makes compilation very fast and allows me to continue to separate compilation and translations.

The disadvantage is that the first call to a real web application compiles for a rather long time, and so far I have not seen the opportunity to speed it up / precompilation (although I believe that this is possible).

Database

I also completed some projects with localization in the database and user blocks <%#...%> for loading languages.

Today I would vote against it, since it is non-standard. Although it would probably be compiling just as quickly, regardless of whether 1 or 50 languages ​​are involved.

Third Party Tools

You can also get a commercial translation product, if I could afford it, I would also be more likely to do this.

Just my two cents ...

+1
source

All Articles