Answered by:
Localization for multi regions and customers

Question
-
User-2082489013 posted
Hi all,
I have a webapp that I need to be able to view in 5 languages. In my application, there have different regions and customers' user. Authorize user is able to change the resource string value. By different region and different customer, in a form, it could be has different caption for a label. For example, a label caption for Europe (region) Apple (Customer) is love Europe Apple, a lable caption for Europe Microsoft is love Europe Microsoft, whereas a label caption for America Microsoft is love America Microsoft. I will give the default value and authorize user is able to change based on their own region and customer's caption. I have to create the custom label control to allow authorize user to change each form's caption if needed. When the caption changed, the resource string value need to change too.
My issue is what is the best approach to store the different language resources? Database approach or satellite assembly? Database will have the performance issue. If i using the satellite assembly, how do i show all the resource strings in gridview and enable it to modify and save all the values changed at the same time? When save it, it need to create a new satellite assembly to replace the old one? Should i create the resource file for each region and customer for each language? If i have 2 regions and 5 customers, it will be 10 customers * 5 languages. Total is 50 resx files. It will hard to maintain it. Please help to give the best solution. Thanks for any reply!!
Thursday, October 20, 2011 5:13 AM
Answers
-
User1622957740 posted
If you use Resx resources that is the default provider and it just works. You don't have to do anything special. Just use the Resource Editor to add resources and then reference those resources in your code either via strongly typed resources or via the ASP.NET provider model (Context.GetLocalResourceObject() COntext.GetGlobalResourceObject). The latter will work the same whether the data comes from Resx resources or from a database provider.
If you want to stick resources into a different assembly you can do that with plain Resx resource. Just create the resources in a separate class libary and either expose the resources via a PUBLIC strongly typed resource class (Internal is default - switch to public in the Resource Editor to allow resources to be accessible cross-assembly). It's easy to do.
However realize that when you are using resources outside of the ASP.NET resource provider you're not using what ASP.NET internally uses so you get the overhead of both the default Resource Provider and the separate ResourceManager used to access the external Resx resources. ASP.NET Resource Providers tend to be very efficient because they agressively cache resources where resource manager access often has to reload resources. And since you can't turn off the default resource provider both will always be active side by side so there's more overhead in doing both.
Lots of options obviously :-) I would stick with what ASP.NET uses natively (Resource Providers) because that's what ASP.NET uses natively and what was designed for that usage scenario. Of course it does depend on what you're building too. If you're building WebForms apps - definitely stick with Resource Provider. If you're building custom handlers or are using MVC then raw resources make more sense although the resource provider will still work as well for explicit resource retrieval.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 24, 2011 5:07 PM
All replies
-
User1622957740 posted
Actually you can use data base resources without much of a performance hit if you use a resource provider. ASP.NET resource providers cache resources in memory so they typically load only once during an application's lifetime. this means database resource drivers don't add significant overhead.
If you want to use a database driven resource provider here's some info and a sample provider you can use:
http://www.west-wind.com/presentations/wwdbresourceprovider/
+++ Rick ---
Friday, October 21, 2011 5:53 PM -
User-2082489013 posted
Hi Rick, thank you so much and appreciate for the information that you provided. Do you have any sample for the satellite assembly approach and regarding the problem that i mentioned?
Thanks for the reply!
Monday, October 24, 2011 1:24 AM -
User1622957740 posted
If you use Resx resources that is the default provider and it just works. You don't have to do anything special. Just use the Resource Editor to add resources and then reference those resources in your code either via strongly typed resources or via the ASP.NET provider model (Context.GetLocalResourceObject() COntext.GetGlobalResourceObject). The latter will work the same whether the data comes from Resx resources or from a database provider.
If you want to stick resources into a different assembly you can do that with plain Resx resource. Just create the resources in a separate class libary and either expose the resources via a PUBLIC strongly typed resource class (Internal is default - switch to public in the Resource Editor to allow resources to be accessible cross-assembly). It's easy to do.
However realize that when you are using resources outside of the ASP.NET resource provider you're not using what ASP.NET internally uses so you get the overhead of both the default Resource Provider and the separate ResourceManager used to access the external Resx resources. ASP.NET Resource Providers tend to be very efficient because they agressively cache resources where resource manager access often has to reload resources. And since you can't turn off the default resource provider both will always be active side by side so there's more overhead in doing both.
Lots of options obviously :-) I would stick with what ASP.NET uses natively (Resource Providers) because that's what ASP.NET uses natively and what was designed for that usage scenario. Of course it does depend on what you're building too. If you're building WebForms apps - definitely stick with Resource Provider. If you're building custom handlers or are using MVC then raw resources make more sense although the resource provider will still work as well for explicit resource retrieval.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 24, 2011 5:07 PM -
User-2082489013 posted
Thanks for the answer!
Monday, October 24, 2011 9:32 PM