Esempio n. 1
0
def check_projects():
    ret = {}
    for lang in LOCAL_LANG_MAP.keys():
        lang_dir = pjoin(BASE_PATH, lang)
        if isdir(lang_dir):
            projects = [f for f in listdir(lang_dir) if not f.startswith(".") and isdir(pjoin(lang_dir, f))]
            ret[lang] = projects
    return ret
Esempio n. 2
0
def check_projects():
    ret = {}
    for lang in LOCAL_LANG_MAP.keys():
        lang_dir = pjoin(BASE_PATH, lang)
        if isdir(lang_dir):
            projects = [
                f for f in listdir(lang_dir)
                if not f.startswith('.') and isdir(pjoin(lang_dir, f))
            ]
            ret[lang] = projects
    return ret
Esempio n. 3
0
def localize_data(issue_data, lang_code):
    "To be called right before rendering html, etc."

    lang_code = issue_data['short_lang_name']
    eng_lang = LANG_MAP[lang_code]
    full_lang_name = LOCAL_LANG_MAP.get(lang_code, eng_lang)
    issue_data['local'] = {'full_lang_name': full_lang_name}

    # add local_date
    issue_date_str = issue_data['date']
    issue_date = parse_date(issue_date_str)
    local_date = format_date(issue_date, format='long', locale=lang_code)
    issue_data['local']['date'] = local_date

    return
Esempio n. 4
0
def localize_data(issue_data, lang_code):
    "To be called right before rendering html, etc."

    lang_code = issue_data["short_lang_name"]
    eng_lang = LANG_MAP[lang_code]
    full_lang_name = LOCAL_LANG_MAP.get(lang_code, eng_lang)
    issue_data["local"] = {"full_lang_name": full_lang_name}

    # add local_date
    issue_date_str = issue_data["date"]
    issue_date = parse_date(issue_date_str)
    local_date = format_date(issue_date, format="long", locale=lang_code)
    issue_data["local"]["date"] = local_date

    return issue_data
Esempio n. 5
0
def localize_data(issue_data, lang_code):
    "To be called right before rendering html, etc."

    lang_code = issue_data['short_lang_name']
    eng_lang = LANG_MAP[lang_code]
    full_lang_name = LOCAL_LANG_MAP.get(lang_code, eng_lang)
    issue_data['local'] = {'full_lang_name': full_lang_name}

    # add local_date
    issue_date_str = issue_data['date']
    issue_date = parse_date(issue_date_str)
    try:
        local_date = format_date(issue_date, format='long', locale=lang_code)
    except UnknownLocaleError as e:
        local_date = format_date(issue_date, format='long', locale='en')
    issue_data['local']['date'] = local_date

    return issue_data