def transliterate(text, lang1_code, lang2_code):
        """
        convert the source language script (lang1) to target language script (lang2)

        text: text to transliterate
        lang1_code: language 1 code 
        lang1_code: language 2 code 
        """
        if langinfo.SCRIPT_RANGES.has_key(
                lang1_code) and langinfo.SCRIPT_RANGES.has_key(lang2_code):

            # if Sinhala is source, do a mapping to Devanagari first
            if lang1_code == 'si':
                text = sdt.sinhala_to_devanagari(text)
                lang1_code = 'hi'

            # if Sinhala is target, make Devanagiri the intermediate target
            org_lang2_code = ''
            if lang2_code == 'si':
                lang2_code = 'hi'
                org_lang2_code = 'si'

            trans_lit_text = []
            for c in text:
                newc = c
                offset = ord(c) - langinfo.SCRIPT_RANGES[lang1_code][0]
                if offset >= langinfo.COORDINATED_RANGE_START_INCLUSIVE and offset <= langinfo.COORDINATED_RANGE_END_INCLUSIVE:
                    if lang2_code == 'ta':
                        # tamil exceptions
                        offset = UnicodeIndicTransliterator._correct_tamil_mapping(
                            offset)
                    newc = unichr(langinfo.SCRIPT_RANGES[lang2_code][0] +
                                  offset)

                trans_lit_text.append(newc)

            # if Sinhala is source, do a mapping to Devanagari first
            if org_lang2_code == 'si':
                return sdt.devanagari_to_sinhala(
                    string.join(trans_lit_text, sep=''))

            return string.join(trans_lit_text, sep='')
        else:
            return text
    def transliterate(text,lang1_code,lang2_code):
        """
        convert the source language script (lang1) to target language script (lang2)

        text: text to transliterate
        lang1_code: language 1 code 
        lang1_code: language 2 code 
        """
        if langinfo.SCRIPT_RANGES.has_key(lang1_code) and langinfo.SCRIPT_RANGES.has_key(lang2_code):
            
            # if Sinhala is source, do a mapping to Devanagari first 
            if lang1_code=='si': 
                text=sdt.sinhala_to_devanagari(text)
                lang1_code='hi'

            # if Sinhala is target, make Devanagiri the intermediate target
            org_lang2_code=''
            if lang2_code=='si': 
                lang2_code='hi'
                org_lang2_code='si'

            trans_lit_text=[]
            for c in text: 
                newc=c
                offset=ord(c)-langinfo.SCRIPT_RANGES[lang1_code][0]
                if offset >=langinfo.COORDINATED_RANGE_START_INCLUSIVE and offset <= langinfo.COORDINATED_RANGE_END_INCLUSIVE:
                    if lang2_code=='ta': 
                        # tamil exceptions 
                        offset=UnicodeIndicTransliterator._correct_tamil_mapping(offset)
                    newc=unichr(langinfo.SCRIPT_RANGES[lang2_code][0]+offset)

                trans_lit_text.append(newc)        

            # if Sinhala is source, do a mapping to Devanagari first 
            if org_lang2_code=='si': 
                return sdt.devanagari_to_sinhala(string.join(trans_lit_text,sep=''))

            return string.join(trans_lit_text,sep='')
        else:
            return text