Solved

Issues with culture in .Net 2.0

Posted on 2006-06-19
3
409 Views
Last Modified: 2008-01-09
Hi,
Could anyone provide any suggestions on how to implement localization features for a multilingual website. Before you jump the guns, let me define the site structure a little more. We have a global site and around 40 country sites. Each of these country sites have localised information both in the native language (fr,de,de-at,it,ar,ar-ae etc). Also, each of these local country sites would have an english counterpart (fr-en,de-en etc). Currently, we do not see how we could define the resource files for the english version of the regional country sites. The issue being that there are no 'cultures' defined as 'fr-en' or 'en-fr'. Is there any way we can map an existing resource file somewhere within the server and use it within my application without copying the files to my App_LocalResource folder?

Also, is there any way we can specify the culture to be used for a page from within a user control or vice-versa. The way we see it, you have have individual resource files for both the page and the user control (and no, using the App_GlobalResources folder is not an option at the moment)

Hope you get the idea. Any help would be greatly appreciated.

Regards,
Sajit
0
Comment
Question by:ap_sajith
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
SnowFlake earned 500 total points
ID: 16937785
I will have to read again more carefully at a more reasonable hour (its past midnight here)
but for the
>Also, is there any way we can specify the culture to be used for a page from within a user control or vice-versa.

the answer for the grneral case is AFAIK:
No, you can not.
this is because the CurrentUICulture can only be set by overriding the Page.InitializeCulture method. This means that when a change is required due to a user action it must be done by remembering the new required UICulture in some server side storage (profile or session) and redirecting back to the current page where you set up the
System.Threading.Thread.CurrentThread.CurrentUICulture based on the previously stored value.

something like:

    protected override void InitializeCulture() {
        base.InitializeCulture();
        if (Session.Contents["UICulture"] != null) {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo((String)Session["UICulture"]);
        }

as for the rest of your Q,
for the
>The issue being that there are no 'cultures' defined as 'fr-en' or 'en-fr'.
maybe this:
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=a193b952-2e44-45ed-811d-c1fabf2f6e8a
can help

also maybe you will find this:
http://www.codeproject.com/useritems/ChangeUICulture.asp
to be helpful.

SnowFlake
0
 
LVL 21

Author Comment

by:ap_sajith
ID: 16978133
Thanks SnowFlake, we managed to use the 'Custom Culture' features as explained in the links provided by you.

Cheers!
0
 
LVL 15

Expert Comment

by:SnowFlake
ID: 16978436
your welcome.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now