Beispiel #1
0
def translateText(text, forlanguage):
    language = forlanguage
    lang = MTLangUtils.languageToLocale(language)
    if lang == '':
        return
    if not prepareDict(lang):
        return
    translatenew(text, language)
    return 1
Beispiel #2
0
def prepareDict(locale):
    global lang
    global language
    lang = locale
    #print(lang)
    language = MTLangUtils.localeToLanguage(locale)
    #print(language)
    if language == '':
        return False
    translationFile = exec_path + '/Test/' + 'hi-' + lang + '.voc'
    #print (translationFile)
    loadTranslationFrom(translationFile)
    return True
Beispiel #3
0
def translateLanguageJobs(atpath, forlanguage):
    language = forlanguage
    lang = MTLangUtils.languageToLocale(language)
    if lang == '':
        return
    if not prepareDict(lang):
        return
    langjobspath = atpath + language + '/'
    jobspath = langjobspath + 'todo/'
    jobs = listJobFolders(jobspath)
    print(jobs)
    for job in jobs:
        print('processing... ' + job)
        translateAllFiles(job, langjobspath)
Beispiel #4
0
def mapTranslate(word, language):
    if language == 'Marathi':
        return word
    #if language=='Punjabi':
    #    return mapTranslatePun(word,language)
    return MTLangUtils.mapHindiString(word, language)