-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #782 from LeXofLeviafan/i18n
implementing support for translations in bukuserver
- Loading branch information
Showing
32 changed files
with
2,200 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
try: # as per Flask-Admin-1.6.1 | ||
try: | ||
from flask_babelex import gettext, ngettext, pgettext, lazy_gettext, lazy_pgettext, LazyString | ||
except ImportError: | ||
from flask_babel import gettext, ngettext, pgettext, lazy_gettext, lazy_pgettext, LazyString | ||
except ImportError: | ||
from flask_admin.babel import gettext, ngettext, lazy_gettext | ||
pgettext = lambda ctx, s, *a, **kw: gettext(s, *a, **kw) | ||
lazy_pgettext = lambda ctx, s, *a, **kw: lazy_gettext(s, *a, **kw) | ||
LazyString = lambda func, *args, **kwargs: func(*args, **kwargs) | ||
|
||
_, _p, _l, _lp = gettext, pgettext, lazy_gettext, lazy_pgettext | ||
|
||
def _key(s): # replicates ad-hoc implementation of "get key from lazy string" used in flask-admin | ||
try: | ||
return s._args[0] # works with _/_l, but not with _lp due to the extra context argument | ||
except Exception: | ||
return str(s) | ||
|
||
__all__ = ['_', '_p', '_l', '_lp', '_key', 'gettext', 'pgettext', 'ngettext', 'lazy_gettext', 'lazy_pgettext', 'LazyString'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
.filters .filter-op {width: 130px !important} | ||
.filters .filter-val {width: 220px !important} | ||
.filters .filter-op {width: var(--filter-op) !important} | ||
.filters .filter-val {width: calc(var(--filters) - var(--filter-op) - var(--filter-buttons) - var(--filter-type)) !important} | ||
#filter_form[action^='/tag/'] {--filter-type: var(--filter-type-tags)} | ||
|
||
:root {--filters: 645px; --filter-op: 9em; --filter-buttons: 12.5em; --filter-type: 5.5em; --filter-type-tags: 9em} | ||
/* due to how flask-admin filters are set up, each language requires manual adjustments for full-width sizes */ | ||
html[lang=de] {--filter-buttons: 19em} | ||
html[lang=fr] {--filter-buttons: 17em} | ||
html[lang=ru] {--filter-buttons: 16.5em; --filter-type: 8.5em; --filter-type-tags: 11em} | ||
|
||
@media (min-width: 768px) { | ||
.filters .filter-op {width: 160px !important} | ||
.filters .filter-val {width: 295px !important} | ||
:root {--filters: 710px; --filter-op: 11.5em} | ||
} | ||
@media (min-width: 992px) { | ||
.filters .filter-op {width: 280px !important} | ||
.filters .filter-val {width: 395px !important} | ||
:root {--filters: 930px; --filter-op: 20em} | ||
} | ||
@media (min-width: 1200px) { | ||
.filters .filter-op {width: 280px !important} | ||
.filters .filter-val {width: 595px !important} | ||
:root {--filters: 1130px; --filter-op: 20em} | ||
html[lang=ru] #filter_form[action^='/bookmark/'] {--filter-op: 25em} /* the last 'buku' filter has a rather long name */ | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.