RTL support (POC) (#2014)

* RTL support (POC)

* restore yarn.lock
This commit is contained in:
Ronen Hayun 2018-11-20 14:10:40 +02:00 committed by Paulus Schoutsen
parent a9704b110d
commit 5da16db81b
3 changed files with 20 additions and 1 deletions

View File

@ -27,6 +27,9 @@ class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
/* remove the grey tap highlights in iOS on the fullscreen touch targets */ /* remove the grey tap highlights in iOS on the fullscreen touch targets */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
:host([rtl]) {
direction: rtl;
}
iron-pages, iron-pages,
ha-sidebar { ha-sidebar {
/* allow a light tap highlight on the actual interface elements */ /* allow a light tap highlight on the actual interface elements */
@ -56,6 +59,7 @@ class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
> >
<app-drawer <app-drawer
id="drawer" id="drawer"
align="start"
slot="drawer" slot="drawer"
disable-swipe="[[_computeDisableSwipe(hass)]]" disable-swipe="[[_computeDisableSwipe(hass)]]"
swipe-open="[[!_computeDisableSwipe(hass)]]" swipe-open="[[!_computeDisableSwipe(hass)]]"
@ -108,6 +112,11 @@ class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
type: Boolean, type: Boolean,
computed: "computeDockedSidebar(hass)", computed: "computeDockedSidebar(hass)",
}, },
rtl: {
type: Boolean,
reflectToAttribute: true,
computed: "computeRTL(hass)",
},
}; };
} }
@ -165,6 +174,14 @@ class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
_computeDisableSwipe(hass) { _computeDisableSwipe(hass) {
return NON_SWIPABLE_PANELS.indexOf(hass.panelUrl) !== -1; return NON_SWIPABLE_PANELS.indexOf(hass.panelUrl) !== -1;
} }
computeRTL(hass) {
var lang = hass.selectedLanguage || hass.language;
if (hass.translationMetadata.translations[lang]) {
return hass.translationMetadata.translations[lang].isRTL || false;
}
return false;
}
} }
customElements.define("home-assistant-main", HomeAssistantMain); customElements.define("home-assistant-main", HomeAssistantMain);

View File

@ -51,7 +51,8 @@
"nativeName": "Schwiizerdütsch" "nativeName": "Schwiizerdütsch"
}, },
"he": { "he": {
"nativeName": "עברית" "nativeName": "עברית",
"isRTL": true
}, },
"hi": { "hi": {
"nativeName": "हिन्दी" "nativeName": "हिन्दी"

View File

@ -60,6 +60,7 @@ export interface Panels {
export interface Translation { export interface Translation {
nativeName: string; nativeName: string;
isRTL: boolean;
fingerprints: { [fragment: string]: string }; fingerprints: { [fragment: string]: string };
} }