Search code examples
vbscriptasp-classic

Classic ASP language (monthname for chinese)


Have been struggling to find a solution for this. I am looking for monthname to return the chinese version of January (or spanish etc.). At the moment it is returning english.

The site is installed on an english windows machine.

I have tried adding session.lcid as well as: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> but I keep getting the english version of the month name (and to change each occurrence is a major code change). Also I need to try and keep the date format as per what I have as changing that might be an issue as well.

Can anyone recommend an answer? Much appreciated.


Solution

  • You need the SetLocale function and the locale identifier of the language.

    Sample test vbs script

    Option Explicit
    
    Dim language, outputString
    
        For Each language In Array( "es-es", "en-us", "zh" )
            SetLocale language
            outputString = outputString & MonthName( 2 ) & vbCrLf
        Next 
    
        WScript.Echo outputString
    

    Output

    Script output capture