Skip to Content
avatar image
Former Member

Multi Lingual Addon

Hi All,

How make an addon which support Multi language

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 27, 2010 at 05:03 PM


    There are many ways you can implement a multilingual addon.

    My approach is to:

    1. I use a property to store the addon's language code (I've setup my system to perceive en-US and en-UK as the same language.

    2. I have a XML file with the translations. Here's a sample of this file...

    <?xml version="1.0" encoding="utf-16" ?>
    			PT="O ficheiro não foi encontrado"
    			EN="File not found"></FileNotFound>
    			PT="Aplicação carregada e pronta a utilizar."
    			EN="Application loaded and ready for use."></AppReady>
    			PT="Ligação estabelecida à empresa "
    			EN="Connection established to company "></ConnSucess>
    			PT="Cód. Artigo"
    			EN="Item Code"></COLItemCode>
    			PT="Descrição do Artigo"
    			EN="Item Name"></COLItemName>

    3. I have a function that get the translation. Here's the code:

    Public Function TranslateStr(ByRef oApplication As SAPbouiCOM.Application, ByRef StringID As String) As String
            TranslateStr = ""
            Dim oXMLDoc As System.Xml.XmlDocument = New Xml.XmlDocument
                If File.Exists(SEI_FldMisc & "strings.xml") Then '## SEI_FldMisc hold the path to the strings.xml file
                    oXMLDoc.Load(SEI_FldMisc & "strings.xml")
                    TranslateStr = oXMLDoc.SelectSingleNode("AddOnStrings/" & StringID & "/@" & SEI_Language).Value '## SEI_Language holds the language code
                End If
            Catch ex As Exception
                oApplication.MessageBox("TranslateStr(" & StringID & "): " & ex.ToString)
                oXMLDoc = Nothing
            End Try
        End Function

    Hope it helps,

    Edited by: Manish Meshram on Jun 27, 2010 7:04 PM

    Add comment
    10|10000 characters needed characters exceeded