def getLangName(file, path=None):
    """Return the language name defined in the .trn file.
    If the name is not found, return the file base name."""
    if not path:
        path = langPath
    f = codecs.open(os.path.join(path, file), "r", "utf-8")
    line = f.readline()
    if "#-# " in line:
        name = line.split("#-# ")[1].strip()
    else:
        name = os.path.splitext(os.path.basename(file))[0]
    line = f.readline()
    regular = None
    if "#-# font regular: " in line:
        regular = line.split("#-# font regular: ")[1].strip()
    line = f.readline()
    bold = None
    if "#-# font bold: " in line:
        bold = line.split("#-# font bold: ")[1].strip()
    global font_lang_cache
    if regular and regular.lower() != "default":
        if not font_lang_cache.get("DejaVuSans-Regular.ttf", False):
            font_lang_cache["DejaVuSans-Regular.ttf"] = {name: regular}
        else:
            font_lang_cache["DejaVuSans-Regular.ttf"][name] = regular
    if bold and bold.lower() != "default":
        if not font_lang_cache.get("DejaVuSans-Bold.ttf", False):
            font_lang_cache["DejaVuSans-Bold.ttf"] = {name: bold}
        else:
            font_lang_cache["DejaVuSans-Bold.ttf"][name] = bold
    resource.font_lang_cache = font_lang_cache
    return name
Return the language name defined in the .trn file.
    If the name is not found, return the file base name.
albow/translate.py