Localization :: How To Get The Main Culture's Language From Country Code
Apr 7, 2010I am using a web service which return country code by the IP.
Now I need to retrieve the language code so I can create a CultureInfo.
How do I do that?
I am using a web service which return country code by the IP.
Now I need to retrieve the language code so I can create a CultureInfo.
How do I do that?
I need to change culture of the specific aspx page bases on the main user's culture.I am able to fetch the data that which culture main user have.But some how I am not able to set the same culture for that aspx page.I had written the below code for that.
[Code]....
But that is not working it sets the default culture of the browser.
I'm using the following msdn article to use different languages in my web application:
http://msdn.microsoft.com/en-us/library/fw69ke6f(v=VS.80).aspx
I'm following the instructions step by step in VS 2010, and it creates the resource files exactly how it's supposed to. However, when I run the program it just doesn't apply it. I don't see the different values from the resource file.
If I leave my resource file name as sample.aspx.resx, it works. But when I change it to sample.aspx.en-us.resx, it doesn't work. I'm supplying culture from the aspx page's Culter and UICulture properties. I'm being very careful in choosing the correct file name, as that could be the issue, but it just doesn't work. I also tried changing the culture in the backend code this way:
Protected
Overrides
Sub InitializeCulture() [code]....
It still doesn't work.
i create a simple webpage to test the Localization. i create two pages.
Default.aspx & Welcome.aspx
i use two languages ENglish & FRench. i already created Localized folder & .RESX of both.
but i can change only current page languages. using UIculture.
but i click on the link for Welcome.aspx.... it still show me ENglish, not showing french. Language conversation only going on Default.aspx page.
here is my Coding:-
for DEFAULT.ASPX:
[Code]....
Now what i have to write in welcome's CS file?
Does anyone knows how to get the country code from Current Thread when I have "en-US"?
I know how to get the language code but not the country code.
I want to have my web site localized to 3 languages english, spanish, french.
Is it possible by clicking the flags on the home page set the globalization culture tweak, in flag image click?
how can to get culture info or just culture name from the datetime string e.g i have strings like: "16/02/2008" or "23/02/2008 " can i know the culture name from the above datetime strings?
View 3 Replieshow can i change exception message language to English without changing the users language
[Code]....
I am developing a multi language website. language change is working very well on master page. from master page I am storing session to use in contant pages.
when I am trying to change text (<p>.....<P>) in content page, thats not working.
protected void Page_PreRender()
Given a CultureInfo object or language tag (e.g. "en-US") string, is there a function that will give me the default DateTime string format (e.g. "mm/dd/yyyy") for that specific culture/language?
View 1 RepliesI need to find out the timezone of the country and i'm using VS2008. I have the following informations
Country name - India
start_boundary_latitude - 6:56N
end_boundary_latitude - 88:50N
start_boundary_Longtitude - 20:26E
end_boundary_Longtitude - 97:02E
ZoneStart - 82.30E
zoneEnd - 82.30E
I have above informations for all countries in my sql table. how to find the timezone for each with the above info. For exampl the timezone should be 5.5 for India.
I have four asp.net web page with masterpage where all the page is in English... now i have set four button on masterpage that are Italy,French,Germany,Spain once user will click in any button they will get all of my content should be convert to tht language..
View 2 RepliesWith asp.net MVC 2, I have been trying to get Matt Hawley's Localization helper to work in my web application, but I am getting stuck feeding a null into the Language string variable. I can't figure out why I am doing this.
namespace MvcLocalization
{
public abstract class LocalizedControllerBase : Controller
{
public String LanguageCode { get; private set; }
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
LanguageCode = requestContext.RouteData.Values["languageCode"].ToString();
if ( !AppConfig.SupportedLanguages.Contains(LanguageCode) )
LanguageCode = AppConfig.DefaultLanguageCode;
System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture(LanguageCode);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
base.Execute(requestContext);
}
}
}
I want to set culture info for my full application. where're i say datetime.now, it should give datetime based on my cultureinfo i set. how do i do it?
View 6 RepliesIs it possible to set TextBox's culture to other then en-EN? If yes then how? I need to be able to allow users to type japanese in textboxes.
View 9 RepliesI have a very simple bilingual site with a link at the bottom that will allow users to switch between the two languages (english/french). the the web.config I have the following line:
<globalization culture="auto" uiCulture="auto" />
This allows for whatever the users browser culture is to be the default lanauge but I'd still like the ablility for them to click a bottom button to toggle. whats the best what to go about doing this?
As per MSDN - Culture is name for traiditional wotd locale But at som many places, people use phrase like . "I am trying to implement culture and locale" Are they same or different?
View 2 Replies I'm trying to change the value of the language and culture values via a database entry and then appending the culture to the returned value. IE: "en" is in the database, I add "-CA" via VB code.When I hardcode the values, it does work no problem. However, appding the "-CA" makes it crash with the following error message:
[Code]....
Now, I'm retrieving the language value from a database and, since the information is used all over the web site, I cannot really change the data within the database.The following code is posted in the Default.aspx page, called by the master page.The function "siteSetLanguage" retrieves from the database the base language (EN/FR) and returns the value. Null values are checked for and if a null value is returned from the database, it defaults to EN.[Code]....
I do want to force UICulture to english as everything in the databases and external files are stored through the english canadian regional method. However, I've been trying to use .resx files using the above method, but to no avail.Needless to say, my language files don't seem to work no matter what I do.
I have an Label where I need to show the value 0.00 if the culture is Englidh and 0,00 if the Culture is french. I am using the following code but it does not work.
string minAmount = "0.00";
DisplayLabel.Text = minAmount.ToString(NumberFormatInfo.CurrentInfo);
below is what I'd like to do (but i cant because cant convert source type string to target type 'System.DateTime'). I want to localize the account.LastUpdated value from DateTime to localized string and have it available to use in my view. Im getting the account.LastUpdated from a service, which I cant control. what I get back is what i get back. do i extend AccountsViewModel to have additional properties in AccountsViewModelFormatted? [Code]....
View 2 RepliesI have drop down list and text box controls contained in asp:table control.
when i change the language of my page.
then drop downlist and text box doesn't display.
the values of dropdownlist and text box are boud from database.
i have three master pages and some contents pages in my project.
in content page i have wrote below script:
[Code]....
And i have a language flags in my master page. so i have created image button for language flag to perform on click action. where On click of language flag (polish) i like to change the content (English) of my page as per the selected flag click.
hence i have wrote in master page:
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="../common/images/pol.gif" AlternateText="Polish" />
And in code behind --- ImageButton1_Click
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("pl-PL")
Thread.CurrentThread.CurrentUICulture = New CultureInfo("pl-PL")
Response.Write(Thread.CurrentThread.CurrentCulture)
Dim geturl As String
geturl = Request.Url.ToString()
Response.Redirect(geturl)
here the geturl is print with "pl-PL" but the page content is printed with English language.
I want to change page content also as per flag seletion.
I am working on an ASP.net web application, the application need to display text in English, Chinese and Japanese based on the parameters passed, however the culture settings such as currency symbol, time and number format should remain as en-US locale.
My understanding about ASP.Net localization is a package deal, am I wrong? If I am right, the only way to do this is to roll my own solution?
Can I call Initialize Culture of every page from the Global.asax?
Every page looks at the query string of "?lang=##" and sets the language accordingly. Since all pages do this, is there a place where I can implement it once and all pages will load it?
My site has around 200 pages and I dont want to implement the code in everypage. Would take too long for maintenance and to implement. It would be more convinient if I could simply put it in a function that all pages call when loading.
I've used 3 languages on my site and I've also put 3 Image Buttons. The language image button that you click will allow that language to be seen on the site. What should I write for that command btn (btn1_command event)
but when I cllick language button, culture should change for all pages for only current user.other users can use different culture.how can I