mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-26 01:50:31 +00:00
Moved language names from iso639.pickle to a python file
This commit is contained in:
parent
eb31b4b00b
commit
9f8cab99e3
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
|
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
|
||||||
@ -18,14 +17,8 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from __future__ import division, print_function, unicode_literals
|
from __future__ import division, print_function, unicode_literals
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
try:
|
|
||||||
import cPickle
|
|
||||||
except ImportError:
|
|
||||||
import pickle as cPickle
|
|
||||||
|
|
||||||
from .constants import TRANSLATIONS_DIR as _TRANSLATIONS_DIR
|
from .iso_language_names import LANGUAGE_NAMES as _LANGUAGE_NAMES
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -54,16 +47,8 @@ except ImportError:
|
|||||||
return _copy_fields(pyc_languages.get(name=name))
|
return _copy_fields(pyc_languages.get(name=name))
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(os.path.join(_TRANSLATIONS_DIR, 'iso639.pickle'), 'rb') as f:
|
|
||||||
_LANGUAGES = cPickle.load(f)
|
|
||||||
except cPickle.UnpicklingError as error:
|
|
||||||
print("Can't read file cps/translations/iso639.pickle: %s" % error)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def get_language_names(locale):
|
def get_language_names(locale):
|
||||||
return _LANGUAGES.get(locale)
|
return _LANGUAGE_NAMES.get(locale)
|
||||||
|
|
||||||
|
|
||||||
def get_language_name(locale, lang_code):
|
def get_language_name(locale, lang_code):
|
||||||
|
5936
cps/iso_language_names.py
Normal file
5936
cps/iso_language_names.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user