def get_locale_data(path, name, domain, react=False): if react: json_file = os.path.join(path, name, 'LC_MESSAGES', 'messages-react.json') if not os.access(json_file, os.R_OK): return {} with open(json_file) as f: rv = json.load(f) rv['messages'][''] = { 'domain': domain, 'lang': name, 'plural_forms': rv['messages']['']['plural_forms'], } return {domain: rv['messages']} else: po_file = os.path.join(path, name, 'LC_MESSAGES', 'messages-js.po') return po_to_json(po_file, domain=domain, locale=name) if os.access(po_file, os.R_OK) else {}
def locale_data(path, name, domain): po_file = os.path.join(path, name, 'LC_MESSAGES', 'messages-js.po') return po_to_json(po_file, domain=domain, locale=name) if os.access(po_file, os.R_OK) else {}