mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 02:27:22 +00:00
Further language support fixes (displaying "non locale" languages translated)
This commit is contained in:
parent
861277460d
commit
3f6a466ca7
@ -1131,10 +1131,11 @@ def edit_list_book(param):
|
|||||||
else:
|
else:
|
||||||
lang_names = list()
|
lang_names = list()
|
||||||
for lang in book.languages:
|
for lang in book.languages:
|
||||||
try:
|
lang_names.append(isoLanguages.get_language_name(get_locale(), lang.lang_code))
|
||||||
lang_names.append(LC.parse(lang.lang_code).get_language_name(get_locale()))
|
#try:
|
||||||
except UnknownLocaleError:
|
# lang_names.append(LC.parse(lang.lang_code).get_language_name(get_locale()))
|
||||||
lang_names.append(_(isoLanguages.get(part3=lang.lang_code).name))
|
#except UnknownLocaleError:
|
||||||
|
# lang_names.append(_(isoLanguages.get(part3=lang.lang_code).name))
|
||||||
ret = Response(json.dumps({'success': True, 'newValue': ', '.join(lang_names)}),
|
ret = Response(json.dumps({'success': True, 'newValue': ', '.join(lang_names)}),
|
||||||
mimetype='application/json')
|
mimetype='application/json')
|
||||||
elif param =='author_sort':
|
elif param =='author_sort':
|
||||||
|
17
cps/opds.py
17
cps/opds.py
@ -433,16 +433,17 @@ def feed_languagesindex():
|
|||||||
if current_user.filter_language() == u"all":
|
if current_user.filter_language() == u"all":
|
||||||
languages = calibre_db.speaking_language()
|
languages = calibre_db.speaking_language()
|
||||||
else:
|
else:
|
||||||
try:
|
#try:
|
||||||
cur_l = LC.parse(current_user.filter_language())
|
# cur_l = LC.parse(current_user.filter_language())
|
||||||
except UnknownLocaleError:
|
#except UnknownLocaleError:
|
||||||
cur_l = None
|
# cur_l = None
|
||||||
languages = calibre_db.session.query(db.Languages).filter(
|
languages = calibre_db.session.query(db.Languages).filter(
|
||||||
db.Languages.lang_code == current_user.filter_language()).all()
|
db.Languages.lang_code == current_user.filter_language()).all()
|
||||||
if cur_l:
|
languages[0].name = isoLanguages.get_language_name(get_locale(), languages[0].lang_code)
|
||||||
languages[0].name = cur_l.get_language_name(get_locale())
|
#if cur_l:
|
||||||
else:
|
# languages[0].name = cur_l.get_language_name(get_locale())
|
||||||
languages[0].name = _(isoLanguages.get(part3=languages[0].lang_code).name)
|
#else:
|
||||||
|
# languages[0].name = _(isoLanguages.get(part3=languages[0].lang_code).name)
|
||||||
pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page,
|
pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page,
|
||||||
len(languages))
|
len(languages))
|
||||||
return render_xml_template('feed.xml', listelements=languages, folder='opds.feed_languages', pagination=pagination)
|
return render_xml_template('feed.xml', listelements=languages, folder='opds.feed_languages', pagination=pagination)
|
||||||
|
47
cps/web.py
47
cps/web.py
@ -606,13 +606,18 @@ def render_category_books(page, book_id, order):
|
|||||||
|
|
||||||
def render_language_books(page, name, order):
|
def render_language_books(page, name, order):
|
||||||
try:
|
try:
|
||||||
cur_l = LC.parse(name)
|
lang_name = isoLanguages.get_language_name(get_locale(), name)
|
||||||
lang_name = cur_l.get_language_name(get_locale())
|
|
||||||
except UnknownLocaleError:
|
|
||||||
try:
|
|
||||||
lang_name = _(isoLanguages.get(part3=name).name)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
#try:
|
||||||
|
# cur_l = LC.parse(name)
|
||||||
|
# lang_name = cur_l.get_language_name(get_locale())
|
||||||
|
#except UnknownLocaleError:
|
||||||
|
# try:
|
||||||
|
# lang_name = _(isoLanguages.get(part3=name).name)
|
||||||
|
# except KeyError:
|
||||||
|
# abort(404)
|
||||||
entries, random, pagination = calibre_db.fill_indexpage(page, 0,
|
entries, random, pagination = calibre_db.fill_indexpage(page, 0,
|
||||||
db.Books,
|
db.Books,
|
||||||
db.Books.languages.any(db.Languages.lang_code == name),
|
db.Books.languages.any(db.Languages.lang_code == name),
|
||||||
@ -819,12 +824,14 @@ def list_books():
|
|||||||
|
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
for index in range(0, len(entry.languages)):
|
for index in range(0, len(entry.languages)):
|
||||||
try:
|
entry.languages[index].language_name = isoLanguages.get_language_name(get_locale(), entry.languages[
|
||||||
entry.languages[index].language_name = LC.parse(entry.languages[index].lang_code)\
|
index].lang_code)
|
||||||
.get_language_name(get_locale())
|
#try:
|
||||||
except UnknownLocaleError:
|
# entry.languages[index].language_name = LC.parse(entry.languages[index].lang_code)\
|
||||||
entry.languages[index].language_name = _(
|
# .get_language_name(get_locale())
|
||||||
isoLanguages.get(part3=entry.languages[index].lang_code).name)
|
#except UnknownLocaleError:
|
||||||
|
# entry.languages[index].language_name = _(
|
||||||
|
# isoLanguages.get(part3=entry.languages[index].lang_code).name)
|
||||||
table_entries = {'totalNotFiltered': total_count, 'total': filtered_count, "rows": entries}
|
table_entries = {'totalNotFiltered': total_count, 'total': filtered_count, "rows": entries}
|
||||||
js_list = json.dumps(table_entries, cls=db.AlchemyEncoder)
|
js_list = json.dumps(table_entries, cls=db.AlchemyEncoder)
|
||||||
|
|
||||||
@ -1003,16 +1010,18 @@ def language_overview():
|
|||||||
languages = calibre_db.speaking_language()
|
languages = calibre_db.speaking_language()
|
||||||
# ToDo: generate first character list for languages
|
# ToDo: generate first character list for languages
|
||||||
else:
|
else:
|
||||||
try:
|
#try:
|
||||||
cur_l = LC.parse(current_user.filter_language())
|
# cur_l = LC.parse(current_user.filter_language())
|
||||||
except UnknownLocaleError:
|
#except UnknownLocaleError:
|
||||||
cur_l = None
|
# cur_l = None
|
||||||
|
|
||||||
languages = calibre_db.session.query(db.Languages).filter(
|
languages = calibre_db.session.query(db.Languages).filter(
|
||||||
db.Languages.lang_code == current_user.filter_language()).all()
|
db.Languages.lang_code == current_user.filter_language()).all()
|
||||||
if cur_l:
|
languages[0].name = isoLanguages.get_language_name(get_locale(), languages[0].name.lang_code)
|
||||||
languages[0].name = cur_l.get_language_name(get_locale())
|
#if cur_l:
|
||||||
else:
|
# languages[0].name = cur_l.get_language_name(get_locale())
|
||||||
languages[0].name = _(isoLanguages.get(part3=languages[0].lang_code).name)
|
#else:
|
||||||
|
# languages[0].name = _(isoLanguages.get(part3=languages[0].lang_code).name)
|
||||||
lang_counter = calibre_db.session.query(db.books_languages_link,
|
lang_counter = calibre_db.session.query(db.books_languages_link,
|
||||||
func.count('books_languages_link.book').label('bookcount')).group_by(
|
func.count('books_languages_link.book').label('bookcount')).group_by(
|
||||||
text('books_languages_link.lang_code')).all()
|
text('books_languages_link.lang_code')).all()
|
||||||
|
Loading…
Reference in New Issue
Block a user