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
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
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
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
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