Langlib

From EventScripts Community Encyclopedia


Module: langlib

Module Overview

EventScripts version: 2.0

Table of Contents

Contents


Description

...

Quick Example

import es
import langlib
import datetime
 
text = None
 
def load():
    global text
    # load our strings
    text = langlib.Strings(es.getAddonPath("myaddon") + "/strings.ini")
 
def round_start(ev):
    es.msg(text("hello world"))
    # using token strings
    tokens = {}
    tokens['date'] = str(datetime.date.today())
    es.msg(text("today is", tokens))

would read the default server language string from the following: myaddon/strings.ini

[hello world]
en="Hello world!"
es="Hola Mundo!"
de="Hallo Welt!"
 
[today is]
en="Today is $date"
es="Hoy es $date"
de="Heute ist $date"

Module Content

Classes

langlib.Strings(ConfigObj)

Methods

langlib.getDefaultLang()

langlib.getLangAbbreviation(fullname)

langlib.getLanguages()

langlib.loadLanguages(filename)

See Also

  • MugMod example for using langlib.
blog comments powered by Disqus