Code Inheritance for localization

Last post 03-13-2007 7:56 AM by SteliosM. 2 replies.

Sort Posts:

  • Code Inheritance for localization

    03-13-2007, 6:01 AM
    • Loading...
    • SteliosM
    • Joined on 10-16-2004, 2:42 AM
    • Greece
    • Posts 26

    Hi to all, 

    I'm working in localizing a web site and I found a video that describes an Override method on the content page as:

    Imports

    System.Threading

    Imports

    System.Globalization

    Partial

    Class _Default

    Inherits System.Web.UI.Page

    Protected Overrides Sub InitializeCulture()

    Dim lang As String = Session("LangSelected")

    If lang IsNot Nothing Or lang <> "" Then

    Thread.CurrentThread.CurrentUICulture =

    New CultureInfo(lang)

    'Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang)

    End If

    End Sub

    End

    Class

     Is it possible to have it in a separate file in app_code and have all pages inherit the code from there?

    Thanks!

  • Re: Code Inheritance for localization

    03-13-2007, 7:44 AM
    Answer
    • Loading...
    • bmains
    • Joined on 10-22-2004, 12:20 PM
    • Posts 5,070

    Hey,

    Sure, I do that all the time.  I have a custom code page like this:

    public class CustomPageBase
        Inherits System.Web.UI.Page


        'Do whatever
    End class

    Then default looks like:

    Public class _Default
        inherits CustomPageBase


    End class

    Brian

    "Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
  • Re: Code Inheritance for localization

    03-13-2007, 7:56 AM
    • Loading...
    • SteliosM
    • Joined on 10-16-2004, 2:42 AM
    • Greece
    • Posts 26

    Thank you bmain

    It was so simple... you are great.

    Stelios

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter