Showing posts with label localization. Show all posts
Showing posts with label localization. Show all posts

Wednesday, March 21, 2012

Localization

Hello,

I am working on a web site which is using localization features since it will uses various languages.

I have a button to switch from one language to another. I am converting it to AJAX.

Usually I have a class from which every page inherits so when the language it is changed the page is refresh and that class changes culture (see the class at the end of this post)

Now, by using AJAX I suppose all I need to do is to place all the localized content inside Update Panels so when I switch language those panels content will be updated with the new culture. right?

This is confusing me.


Thanks,

Miguel

' Config
Public Class Config
Inherits Page

' Culture | Initialize Culture
Protected Overrides Sub InitializeCulture()

' Call base class implementation
MyBase.InitializeCulture()

' Get culture from profile
Dim culture As String = CType(Context.Profile, ProfileCommon).Settings.Culture

' Check if user has requested specific culture
If (culture IsNot Nothing) AndAlso (culture <> "Auto") Then

' Assign culture UI
MyBase.UICulture = culture

' Assign culture with region
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture)

End If

End Sub ' InitializeCulture

End Class ' Config

Try to take a look at this reading about Ajax & Localization -http://blog.languagetranslation.com/public/item/126228

Localization of the date format in CalendarExtender

Is it possible to change the format of the today date in the footer of the CalendarExtender?

The CalendarExtender localizes the text correctly (i.e. Heute for german) but the date format is always MMM dd, yyyy. I want to change that to dd.MM.yyyy for german.

I tried to change "Heute: {0}" to "Heute: {0: dd.MM.yyyy}" in the ScriptResources.de.resx resource but nothing changed.

Any ideas?

Seehttp://asp.net/AJAX/Control-Toolkit/Live/Calendar/Calendar.aspx andhttp://msdn2.microsoft.com/en-us/library/bz9tc508.aspx.

You should just be able to set the Format property to a standard format (http://msdn2.microsoft.com/en-us/library/bb79761a-ca08-44ee-b142-b06b3e2fc22b.aspx)

-Damien


dwhite:

You should just be able to set the Format property to a standard format

Which Format property do you mean? The Format property on the CalendarExtender is used to format the date that is set in the extended TextBox, not the date that is displayed in the footer of the calendar for today.

Everything is localized correctly (Days, Months, Today-string) but the date format is wrong, it is always in MMM dd, yyyy

Note:
ScriptManager.EnableScriptGlobalization and EnableScriptLocalization are both set to true.


Sorry, I understand you now.

In the CalendarBehavior.js file, line 943:

this._today.appendChild(document.createTextNode(String.format(AjaxControlToolkit.Resources.Calendar_Today, todaysDate.localeFormat("MMMM d, yyyy"))));

Try changing that format and recompile the tool kit. (Also, there may be a fix in one of the later releases on the toolkit, I didn't check).

-Damien


Thanks a lot!

I'll change that as I need it. Lucky me, all cultures I have to support use dd.MM.yyyy.

dwhite:

Also, there may be a fix in one of the later releases on the toolkit, I didn't check

Lets' hope so.