Browse Source

Right-to-Left support for Glitter and Config (#1776)

* Add rtl on main page

* Adjustments to rtl

* Forgot to add black check for this checkout

* Remove unnecessary style

* Remove more redundant attributes

* Some more reordering and alignment

* Align sorting and nzb drop downs

* Update NZB details and shutdown page

* Fix format

* Fix SABnzbd Config title tag

* Change file list header direction

* Set rtl variables in build_header instead and test dir="rtl" in config pages

* Revert some changes and handle styling using CSS

* Move more items to CSS

* Config RTL

* Move even more to CSS

* Small tweak

Co-authored-by: Safihre <safihre@sabnzbd.org>
pull/1791/head
puzzledsab 4 years ago
committed by GitHub
parent
commit
ae2cee3fda
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      interfaces/Config/templates/_inc_header_uc.tmpl
  2. 4
      interfaces/Config/templates/config_rss.tmpl
  3. 22
      interfaces/Config/templates/staticcfg/css/style.css
  4. 2
      interfaces/Glitter/templates/main.tmpl
  5. 39
      interfaces/Glitter/templates/static/stylesheets/glitter.css
  6. 2
      sabnzbd/api.py
  7. 189
      sabnzbd/lang.py
  8. 2
      sabnzbd/skintext.py

2
interfaces/Config/templates/_inc_header_uc.tmpl

@ -4,7 +4,7 @@
#set global $root = '../../'#
#end if#
<!DOCTYPE HTML>
<html lang="$active_lang">
<html lang="$active_lang" #if $rtl#dir="rtl"#end if#>
<head>
<title>
SABnzbd $T('menu-config')

4
interfaces/Config/templates/config_rss.tmpl

@ -59,7 +59,7 @@
<td class="controls">
<button type="button" class="btn btn-default testFeed" rel="$feed_item_html"><span class="glyphicon glyphicon-sort"></span> $T('button-preFeed')</button>
<input type="hidden" name="uri" value="$rss[$feed_item]['uris']" />
<button type="button" class="btn btn-default editFeed" rel="$feed_item_html"><span class="glyphicon glyphicon-pencil"></span> $T('Edit')</button>
<button type="button" class="btn btn-default editFeed" rel="$feed_item_html"><span class="glyphicon glyphicon-pencil"></span> $T('rss-edit')</button>
<button type="button" class="btn btn-default delFeed" rel="$feed_item_html"><span class="glyphicon glyphicon-trash"></span></button>
</td>
</tr>
@ -92,7 +92,7 @@
<label class="config narrow" for="rss_rate">$T('opt-rss_rate')</label>
<input type="number" name="rss_rate" id="rss_rate" value="$rss_rate" min="15" max="1440" />
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> $T('button-save')</button>
<span class="config narrow">&nbsp;&nbsp;$T('Next scan at:')&nbsp;$rss_next</span>
<span class="config narrow">&nbsp;&nbsp;$T('rss-nextscan'): $rss_next</span>
<span class="desc narrow">$T('explain-rss_rate')</span>
</div>
</fieldset>

22
interfaces/Config/templates/staticcfg/css/style.css

@ -162,6 +162,7 @@ input[type="checkbox"]+.desc {
float: none;
overflow: hidden;
min-width: 555px;
position: relative;
}
.Key tr:nth-child(odd),
.tab-pane tr:nth-child(odd),
@ -1168,6 +1169,27 @@ input[type="checkbox"] {
100% { transform: rotate(359deg); }
}
/***
RTL Fixes
***/
html[dir="rtl"] .col1 input[type='checkbox'],
html[dir="rtl"] .col2 h3 a {
left: 5px;
}
html[dir="rtl"] .modal-header .close {
float: left;
}
html[dir="rtl"] .Sorting .presets.float-left,
html[dir="rtl"] .checkbox-days {
float: none;
}
html[dir="rtl"] .Scheduling form[action="addSchedule"] input[type="checkbox"] {
right: 5px;
}
@media screen and (min-width: 1200px) {
.Categories input[name="dir"] {
max-width: 240px !important;

2
interfaces/Glitter/templates/main.tmpl

@ -1,6 +1,6 @@
<!DOCTYPE html>
<!--#set $active_lang=$active_lang.replace('_', '-').lower()#-->
<html lang="$active_lang" id="sabnzbd" data-bind="filedrop: { overlaySelector: '.main-filedrop', onFileDrop: addNZBFromFile }">
<html lang="$active_lang" <!--#if $rtl#-->dir="rtl"<!--#end if#--> id="sabnzbd" data-bind="filedrop: { overlaySelector: '.main-filedrop', onFileDrop: addNZBFromFile }">
<head>
<!--
Glitter V2

39
interfaces/Glitter/templates/static/stylesheets/glitter.css

@ -1979,6 +1979,45 @@ input[name="nzbURL"] {
}
}
/***
RTL Fixes
***/
html[dir="rtl"] .navbar-nav {
padding-right: 0;
}
html[dir="rtl"] .queue h2,
html[dir="rtl"] .history h2 {
float: right;
}
html[dir="rtl"] .dropdown-menu {
text-align: right;
direction: rtl;
}
html[dir="rtl"] .speedlimit-dropdown,
html[dir="rtl"] .progress-indicator,
html[dir="rtl"] #modal-item-filelist,
html[dir="rtl"] #modal-item-files .modal-title,
html[dir="rtl"] .info-container-box,
html[dir="rtl"] .queue-table,
html[dir="rtl"] .history-table {
direction: ltr;
}
html[dir="rtl"] .search-box a {
right: initial;
left: 8px;
}
html[dir="rtl"] .navbar-logo,
html[dir="rtl"] .info-container,
html[dir="rtl"] .modal-header .close,
html[dir="rtl"] #modal-options .modal-header a {
float: left;
}
/***
Bootstrap overwrites

2
sabnzbd/api.py

@ -63,6 +63,7 @@ from sabnzbd.encoding import xml_name
from sabnzbd.utils.servertests import test_nntp_server_dict
from sabnzbd.getipaddress import localipv4, publicipv4, ipv6, addresslookup
from sabnzbd.database import build_history_info, unpack_history_info, HistoryDB
from sabnzbd.lang import is_rtl
import sabnzbd.notifier
import sabnzbd.rss
import sabnzbd.emailer
@ -1600,6 +1601,7 @@ def build_header(webdir="", output=None, trans_functions=True):
header["restart_req"] = sabnzbd.RESTART_REQ
header["pid"] = os.getpid()
header["active_lang"] = cfg.language()
header["rtl"] = is_rtl(header["active_lang"])
header["my_lcldata"] = clip_path(sabnzbd.DIR_LCLDATA)
header["my_home"] = clip_path(sabnzbd.DIR_HOME)

189
sabnzbd/lang.py

@ -92,99 +92,104 @@ def list_languages():
return lst
def is_rtl(lang):
return LanguageTable.get(lang, "en")[3]
# English name, native name, code page, right-to-left
LanguageTable = {
"aa": ("Afar", "Afaraf", 0),
"af": ("Afrikaans", "Afrikaans", 0),
"ak": ("Akan", "Akan", 0),
"sq": ("Albanian", "Shqip", 0),
"an": ("Aragonese", "Aragonés", 0),
"ae": ("Avestan", "Avesta", 0),
"ay": ("Aymara", "Aymararu", 0),
"bm": ("Bambara", "Bamanankan", 0),
"eu": ("Basque", "Euskara", 0),
"bi": ("Bislama", "Bislama", 0),
"bs": ("Bosnian", "Bosanskijezik", 0),
"br": ("Breton", "Brezhoneg", 0),
"ca": ("Catalan", "Català", 0),
"ch": ("Chamorro", "Chamoru", 0),
"kw": ("Cornish", "Kernewek", 0),
"co": ("Corsican", "Corsu", 0),
"hr": ("Croatian", "Hrvatski", 0),
"cs": ("Czech", "Cesky, ceština", 0),
"da": ("Danish", "Dansk", 0),
"nl": ("Dutch", "Nederlands", 0),
"en": ("English", "English", 0),
"eo": ("Esperanto", "Esperanto", 0),
"et": ("Estonian", "Eesti", 0),
"fo": ("Faroese", "Føroyskt", 0),
"fj": ("Fijian", "Vosa Vakaviti", 0),
"fi": ("Finnish", "Suomi", 0),
"fr": ("French", "Français", 0),
"gl": ("Galician", "Galego", 0),
"de": ("German", "Deutsch", 0),
"he": ("Hebrew", "עִבְרִית‎", 1255),
"hz": ("Herero", "Otjiherero", 0),
"ho": ("Hiri Motu", "Hiri Motu", 0),
"hu": ("Hungarian", "Magyar", 0),
"id": ("Indonesian", "Bahasa Indonesia", 0),
"ga": ("Irish", "Gaeilge", 0),
"io": ("Ido", "Ido", 0),
"is": ("Icelandic", "Íslenska", 0),
"it": ("Italian", "Italiano", 0),
"jv": ("Javanese", "BasaJawa", 0),
"rw": ("Kinyarwanda", "Ikinyarwanda", 0),
"kg": ("Kongo", "KiKongo", 0),
"kj": ("Kwanyama", "Kuanyama", 0),
"la": ("Latin", "Lingua latina", 0),
"lb": ("Luxembourgish", "Lëtzebuergesch", 0),
"lg": ("Luganda", "Luganda", 0),
"li": ("Limburgish", "Limburgs", 0),
"ln": ("Lingala", "Lingála", 0),
"lt": ("Lithuanian", "Lietuviukalba", 0),
"lv": ("Latvian", "Latviešuvaloda", 0),
"gv": ("Manx", "Gaelg", 0),
"mg": ("Malagasy", "Malagasy fiteny", 0),
"mt": ("Maltese", "Malti", 0),
"nb": ("Norwegian Bokmål", "Norsk bokmål", 0),
"nn": ("Norwegian Nynorsk", "Norsk nynorsk", 0),
"no": ("Norwegian", "Norsk", 0),
"oc": ("Occitan", "Occitan", 0),
"om": ("Oromo", "Afaan Oromoo", 0),
"pl": ("Polish", "Polski", 0),
"pt": ("Portuguese", "Português", 0),
"pt_BR": ("Portuguese Brazillian", "Português Brasileiro", 0),
"rm": ("Romansh", "Rumantsch grischun", 0),
"rn": ("Kirundi", "kiRundi", 0),
"ro": ("Romanian", "Româna", 1250),
"sc": ("Sardinian", "Sardu", 0),
"se": ("Northern Sami", "Davvisámegiella", 0),
"sm": ("Samoan", "Gagana fa'a Samoa", 0),
"gd": ("Gaelic", "Gàidhlig", 0),
"ru": ("Russian", "русский язык", 1251),
"sr": ("Serbian", "српски", 1251),
"sn": ("Shona", "Chi Shona", 0),
"sk": ("Slovak", "Slovencina", 0),
"sl": ("Slovene", "Slovenšcina", 0),
"st": ("Southern Sotho", "Sesotho", 0),
"es": ("Spanish Castilian", "Español, castellano", 0),
"su": ("Sundanese", "Basa Sunda", 0),
"sw": ("Swahili", "Kiswahili", 0),
"ss": ("Swati", "SiSwati", 0),
"sv": ("Swedish", "Svenska", 0),
"tn": ("Tswana", "Setswana", 0),
"to": ("Tonga (Tonga Islands)", "faka Tonga", 0),
"tr": ("Turkish", "Türkçe", 0),
"ts": ("Tsonga", "Xitsonga", 0),
"tw": ("Twi", "Twi", 0),
"ty": ("Tahitian", "Reo Tahiti", 0),
"wa": ("Walloon", "Walon", 0),
"cy": ("Welsh", "Cymraeg", 0),
"wo": ("Wolof", "Wollof", 0),
"fy": ("Western Frisian", "Frysk", 0),
"xh": ("Xhosa", "isi Xhosa", 0),
"yo": ("Yoruba", "Yorùbá", 0),
"zu": ("Zulu", "isi Zulu", 0),
"zh_CN": ("SimpChinese", "简体中文", 936),
"aa": ("Afar", "Afaraf", 0, False),
"af": ("Afrikaans", "Afrikaans", 0, False),
"ak": ("Akan", "Akan", 0, False),
"sq": ("Albanian", "Shqip", 0, False),
"an": ("Aragonese", "Aragonés", 0, False),
"ae": ("Avestan", "Avesta", 0, False),
"ay": ("Aymara", "Aymararu", 0, False),
"bm": ("Bambara", "Bamanankan", 0, False),
"eu": ("Basque", "Euskara", 0, False),
"bi": ("Bislama", "Bislama", 0, False),
"bs": ("Bosnian", "Bosanskijezik", 0, False),
"br": ("Breton", "Brezhoneg", 0, False),
"ca": ("Catalan", "Català", 0, False),
"ch": ("Chamorro", "Chamoru", 0, False),
"kw": ("Cornish", "Kernewek", 0, False),
"co": ("Corsican", "Corsu", 0, False),
"hr": ("Croatian", "Hrvatski", 0, False),
"cs": ("Czech", "Cesky, ceština", 0, False),
"da": ("Danish", "Dansk", 0, False),
"nl": ("Dutch", "Nederlands", 0, False),
"en": ("English", "English", 0, False),
"eo": ("Esperanto", "Esperanto", 0, False),
"et": ("Estonian", "Eesti", 0, False),
"fo": ("Faroese", "Føroyskt", 0, False),
"fj": ("Fijian", "Vosa Vakaviti", 0, False),
"fi": ("Finnish", "Suomi", 0, False),
"fr": ("French", "Français", 0, False),
"gl": ("Galician", "Galego", 0, False),
"de": ("German", "Deutsch", 0, False),
"he": ("Hebrew", "עִבְרִית‎", 1255, True),
"hz": ("Herero", "Otjiherero", 0, False),
"ho": ("Hiri Motu", "Hiri Motu", 0, False),
"hu": ("Hungarian", "Magyar", 0, False),
"id": ("Indonesian", "Bahasa Indonesia", 0, False),
"ga": ("Irish", "Gaeilge", 0, False),
"io": ("Ido", "Ido", 0, False),
"is": ("Icelandic", "Íslenska", 0, False),
"it": ("Italian", "Italiano", 0, False),
"jv": ("Javanese", "BasaJawa", 0, False),
"rw": ("Kinyarwanda", "Ikinyarwanda", 0, False),
"kg": ("Kongo", "KiKongo", 0, False),
"kj": ("Kwanyama", "Kuanyama", 0, False),
"la": ("Latin", "Lingua latina", 0, False),
"lb": ("Luxembourgish", "Lëtzebuergesch", 0, False),
"lg": ("Luganda", "Luganda", 0, False),
"li": ("Limburgish", "Limburgs", 0, False),
"ln": ("Lingala", "Lingála", 0, False),
"lt": ("Lithuanian", "Lietuviukalba", 0, False),
"lv": ("Latvian", "Latviešuvaloda", 0, False),
"gv": ("Manx", "Gaelg", 0, False),
"mg": ("Malagasy", "Malagasy fiteny", 0, False),
"mt": ("Maltese", "Malti", 0, False),
"nb": ("Norwegian Bokmål", "Norsk bokmål", 0, False),
"nn": ("Norwegian Nynorsk", "Norsk nynorsk", 0, False),
"no": ("Norwegian", "Norsk", 0, False),
"oc": ("Occitan", "Occitan", 0, False),
"om": ("Oromo", "Afaan Oromoo", 0, False),
"pl": ("Polish", "Polski", 0, False),
"pt": ("Portuguese", "Português", 0, False),
"pt_BR": ("Portuguese Brazillian", "Português Brasileiro", 0, False),
"rm": ("Romansh", "Rumantsch grischun", 0, False),
"rn": ("Kirundi", "kiRundi", 0, False),
"ro": ("Romanian", "Româna", 1250, False),
"sc": ("Sardinian", "Sardu", 0, False),
"se": ("Northern Sami", "Davvisámegiella", 0, False),
"sm": ("Samoan", "Gagana fa'a Samoa", 0, False),
"gd": ("Gaelic", "Gàidhlig", 0, False),
"ru": ("Russian", "русский язык", 1251, False),
"sr": ("Serbian", "српски", 1251, False),
"sn": ("Shona", "Chi Shona", 0, False),
"sk": ("Slovak", "Slovencina", 0, False),
"sl": ("Slovene", "Slovenšcina", 0, False),
"st": ("Southern Sotho", "Sesotho", 0, False),
"es": ("Spanish Castilian", "Español, castellano", 0, False),
"su": ("Sundanese", "Basa Sunda", 0, False),
"sw": ("Swahili", "Kiswahili", 0, False),
"ss": ("Swati", "SiSwati", 0, False),
"sv": ("Swedish", "Svenska", 0, False),
"tn": ("Tswana", "Setswana", 0, False),
"to": ("Tonga (Tonga Islands)", "faka Tonga", 0, False),
"tr": ("Turkish", "Türkçe", 0, False),
"ts": ("Tsonga", "Xitsonga", 0, False),
"tw": ("Twi", "Twi", 0, False),
"ty": ("Tahitian", "Reo Tahiti", 0, False),
"wa": ("Walloon", "Walon", 0, False),
"cy": ("Welsh", "Cymraeg", 0, False),
"wo": ("Wolof", "Wollof", 0, False),
"fy": ("Western Frisian", "Frysk", 0, False),
"xh": ("Xhosa", "isi Xhosa", 0, False),
"yo": ("Yoruba", "Yorùbá", 0, False),
"zu": ("Zulu", "isi Zulu", 0, False),
"zh_CN": ("SimpChinese", "简体中文", 936, False),
}
# Setup a safe null-translation

2
sabnzbd/skintext.py

@ -678,6 +678,8 @@ SKIN_TEXT = {
"addMultipleFeeds": TT("Seperate multiple URLs by a comma"), #: Config->RSS, placeholder (cannot be too long)
"button-preFeed": TT("Read Feed"), #: Config->RSS button
"button-forceFeed": TT("Force Download"), #: Config->RSS button
"rss-edit": TT("Edit"), #: Config->RSS edit button
"rss-nextscan": TT("Next scan at"), #: Config->RSS when will be the next RSS scan
"rss-order": TT("Order"), #: Config->RSS table column header
"rss-type": TT("Type"), #: Config->RSS table column header
"rss-filter": TT("Filter"), #: Config->RSS table column header

Loading…
Cancel
Save