Manoj Singh
Manoj Singh

Reputation: 7707

What is C# sample code for VBScript SetLocale Function

I have got below code in VBScript.

Sub SetPageLocale()
    Dim Locale
    Dim ContextObject
    Set ContextObject=getContextObject
    Locale=getFieldValue(ContextObject.Publication.MetadataFields("Configuration").Value(1).Fields("Locale"),"")
    If Locale<>"" Then
        SetLocale(Locale)
    Else
        SetLocale("en-gb")' Move to Constants TBB
    End If

    Set ContextObject = Nothing
End Sub

Now I want to convert above code in C#. Especially I am looking for C# code for VbScript SetLocale function

Upvotes: 1

Views: 1764

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039120

In .NET you could the CultureInfo class to set the locale of the current thread:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");

Upvotes: 1

Related Questions