Hebrew and RTL support (#378)

This commit is contained in:
Avraham Ben Arosh 2022-08-31 15:19:51 +03:00 committed by sienori
parent 8153ee9463
commit 7288f2d1ae
15 changed files with 68 additions and 41 deletions

View file

@ -1,4 +1,4 @@
<img src="https://raw.githubusercontent.com/sienori/simple-translate/master/src/icons/64.png" align="left" height="64px" style="margin-right:10px"> <img src="https://raw.githubusercontent.com/sienori/simple-translate/master/src/icons/64.png" align="left" height="64px" style="margin-inline-end:10px">
# Simple Translate # Simple Translate

View file

@ -4,7 +4,7 @@ body {
img { img {
height: 110px; height: 110px;
margin-right: 20px; margin-inline-end: 20px;
} }
a { a {

View file

@ -68,7 +68,7 @@ export default props => {
<div> <div>
<a href={patreonLink} target="_blank"> <a href={patreonLink} target="_blank">
<img src="/icons/patreonButton.png" alt="Patreon" <img src="/icons/patreonButton.png" alt="Patreon"
style={{ height: 44, marginRight: 20 }} /> style={{ height: 44, marginInlineEnd: 20 }} />
</a> </a>
<a href={paypalLink} target="_blank"> <a href={paypalLink} target="_blank">
<img src="/icons/paypalButton.png" alt="Paypal" /> <img src="/icons/paypalButton.png" alt="Paypal" />

View file

@ -22,12 +22,16 @@ const setupTheme = async () => {
}); });
}; };
const UILanguage = browser.i18n.getUILanguage()
const rtlLanguage = ['he', 'ar'].includes(UILanguage)
const optionsPageClassName = 'optionsPage' + (rtlLanguage ? ' rtl-language' : '')
export default () => { export default () => {
setupTheme(); setupTheme();
return ( return (
<HashRouter hashType="noslash"> <HashRouter hashType="noslash">
<ScrollToTop> <ScrollToTop>
<div className="optionsPage"> <div className={optionsPageClassName}>
<SideBar /> <SideBar />
<ContentsArea /> <ContentsArea />
</div> </div>

View file

@ -9,7 +9,7 @@
} }
.categoryElements { .categoryElements {
padding-left: 20px; padding-inline-start: 20px;
margin-bottom: 30px; margin-bottom: 30px;
} }
} }

View file

@ -1,5 +1,5 @@
.contentsArea { .contentsArea {
margin-left: 150px; margin-inline-start: 150px;
width: 650px; width: 650px;
.contentTitle { .contentTitle {

View file

@ -37,15 +37,15 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
margin-left: 10px; margin-inline-start: 10px;
} }
&.buttonsContainer { &.buttonsContainer {
justify-content: flex-start; justify-content: flex-start;
} }
} }
.childElements { .childElements {
padding-left: 20px; padding-inline-start: 20px;
border-left: solid 10px var(--line); border-inline-start: solid 10px var(--line);
} }
} }
@ -91,8 +91,8 @@ textarea {
-moz-appearance: textfield; -moz-appearance: textfield;
border: 1px var(--button) solid; border: 1px var(--button) solid;
border-radius: 2px; border-radius: 2px;
padding-left: 5px; padding-inline-start: 5px;
padding-right: 5px; padding-inline-end: 5px;
padding: 5px; padding: 5px;
width: calc(100% - 12px) !important; width: calc(100% - 12px) !important;
height: 50px; height: 50px;
@ -109,8 +109,8 @@ input[type="color"] {
-moz-appearance: textfield; -moz-appearance: textfield;
width: 50px; width: 50px;
height: 30px; height: 30px;
padding-left: 5px; padding-inline-start: 5px;
padding-right: 5px; padding-inline-end: 5px;
border: 1px solid var(--button); border: 1px solid var(--button);
border-radius: 2px; border-radius: 2px;
@ -139,12 +139,17 @@ input[type="checkbox"] {
display: block; display: block;
position: absolute; position: absolute;
top: 1px; top: 1px;
left: 4px; inset-inline-start: 4px;
width: 6px; width: 6px;
height: 14px; height: 14px;
transform: rotate(40deg); transform: rotate(40deg);
.rtl-language & {
transform: rotate(40deg) scaleX(-1);
}
border-bottom: 3px solid var(--highlight); border-bottom: 3px solid var(--highlight);
border-right: 3px solid var(--highlight); border-inline-end: 3px solid var(--highlight);
} }
} }
&:focus + .checkbox::before { &:focus + .checkbox::before {
@ -153,7 +158,7 @@ input[type="checkbox"] {
} }
.checkbox { .checkbox {
padding-left: 20px; padding-inline-start: 20px;
position: relative; position: relative;
cursor: pointer; cursor: pointer;
&::before { &::before {
@ -161,7 +166,7 @@ input[type="checkbox"] {
display: block; display: block;
position: absolute; position: absolute;
top: 0; top: 0;
left: -2px; inset-inline-start: -2px;
width: 20px; width: 20px;
height: 20px; height: 20px;
border: 1px solid var(--button); border: 1px solid var(--button);
@ -185,7 +190,7 @@ input[type="radio"] {
display: block; display: block;
position: absolute; position: absolute;
top: 6px; top: 6px;
left: 4px; inset-inline-start: 4px;
width: 10px; width: 10px;
height: 10px; height: 10px;
border-radius: 50%; border-radius: 50%;
@ -197,7 +202,7 @@ input[type="radio"] {
} }
.radio { .radio {
padding-left: 20px; padding-inline-start: 20px;
position: relative; position: relative;
cursor: pointer; cursor: pointer;
&::before { &::before {
@ -205,7 +210,7 @@ input[type="radio"] {
display: block; display: block;
position: absolute; position: absolute;
top: 0; top: 0;
left: -2px; inset-inline-start: -2px;
width: 20px; width: 20px;
height: 20px; height: 20px;
border: 1px solid var(--button); border: 1px solid var(--button);
@ -234,7 +239,7 @@ select {
border: var(--button) solid 1px; border: var(--button) solid 1px;
border-radius: 2px; border-radius: 2px;
padding: 3px 5px; padding: 3px 5px;
padding-right: 20px; padding-inline-end: 20px;
width: 100%; width: 100%;
height: 30px; height: 30px;
scrollbar-color: var(--button) var(--line); scrollbar-color: var(--button) var(--line);
@ -252,17 +257,22 @@ select {
z-index: 1; z-index: 1;
position: absolute; position: absolute;
top: 35%; top: 35%;
right: 7px; inset-inline-end: 7px;
width: 5px; width: 5px;
height: 5px; height: 5px;
transform: rotate(45deg); transform: rotate(45deg);
.rtl-language & {
transform: rotate(-45deg);
}
border-bottom: 2px solid var(--sub-text); border-bottom: 2px solid var(--sub-text);
border-right: 2px solid var(--sub-text); border-inline-end: 2px solid var(--sub-text);
} }
&:hover::before { &:hover::before {
border-bottom: 2px solid var(--highlight); border-bottom: 2px solid var(--highlight);
border-right: 2px solid var(--highlight); border-inline-end: 2px solid var(--highlight);
} }
} }
@ -341,7 +351,7 @@ input[type="file"] {
} }
&.clearButton { &.clearButton {
right: 0px; inset-inline-end: 0px;
margin: 3px; margin: 3px;
svg { svg {
fill: var(--sub-text); fill: var(--sub-text);
@ -352,7 +362,7 @@ input[type="file"] {
} }
&.resetButton { &.resetButton {
right: -20px; inset-inline-end: -20px;
margin: -3px; margin: -3px;
svg { svg {
fill: var(--sub-text); fill: var(--sub-text);

View file

@ -56,6 +56,9 @@ body {
color: var(--main-text); color: var(--main-text);
line-height: 1.5; line-height: 1.5;
margin: 20px 40px; margin: 20px 40px;
&.rtl-language{
direction: rtl;
}
} }
::-moz-selection { ::-moz-selection {

View file

@ -2,7 +2,7 @@
position: fixed; position: fixed;
font-size: 17px; font-size: 17px;
font-weight: 400; font-weight: 400;
text-align: right; text-align: end;
-moz-user-select: none; -moz-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
flex-shrink: 0; flex-shrink: 0;
@ -16,10 +16,10 @@
.logo { .logo {
height: 64px; height: 64px;
width: 64px; width: 64px;
margin-right: 5px; margin-inline-end: 5px;
} }
.logoTitle { .logoTitle {
text-align: left; text-align: start;
font-size: 14px; font-size: 14px;
font-weight: 300; font-weight: 300;
color: var(--sub-text); color: var(--sub-text);

View file

@ -33,6 +33,11 @@ const getTabInfo = async () => {
} }
}; };
const UILanguage = browser.i18n.getUILanguage()
const rtlLanguage = ['he', 'ar'].includes(UILanguage)
const rtlLanguageClassName = rtlLanguage ? 'popup-page-rtl-language' : ''
export default class PopupPage extends Component { export default class PopupPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -166,7 +171,7 @@ export default class PopupPage extends Component {
render() { render() {
return ( return (
<div> <div className={rtlLanguageClassName}>
<Header <Header
toggleEnabledOnPage={this.toggleEnabledOnPage} toggleEnabledOnPage={this.toggleEnabledOnPage}
isEnabledOnPage={this.state.isEnabledOnPage} isEnabledOnPage={this.state.isEnabledOnPage}

View file

@ -5,7 +5,7 @@
.copiedText { .copiedText {
color: var(--sub-text); color: var(--sub-text);
font-size: 12px; font-size: 12px;
margin-right: 5px; margin-inline-end: 5px;
-moz-user-select: none; -moz-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
} }

View file

@ -20,26 +20,31 @@
.selectWrap { .selectWrap {
position: relative; position: relative;
margin-left: 5px; margin-inline-start: 5px;
&:before { &:before {
pointer-events: none; pointer-events: none;
content: ""; content: "";
z-index: 1; z-index: 1;
position: absolute; position: absolute;
top: 35%; top: 35%;
right: 7px; inset-inline-end: 7px;
width: 5px; width: 5px;
height: 5px; height: 5px;
transform: rotate(45deg); transform: rotate(45deg);
.popup-page-rtl-language & {
transform: rotate(-45deg);
}
border-bottom: 2px solid var(--sub-text); border-bottom: 2px solid var(--sub-text);
border-right: 2px solid var(--sub-text); border-inline-end: 2px solid var(--sub-text);
transition: border-color 100ms ease-out; transition: border-color 100ms ease-out;
} }
&:hover::before { &:hover::before {
border-bottom: 2px solid var(--highlight); border-bottom: 2px solid var(--highlight);
border-right: 2px solid var(--highlight); border-inline-end: 2px solid var(--highlight);
} }
select { select {
@ -51,7 +56,7 @@
border: var(--button) solid 1px; border: var(--button) solid 1px;
border-radius: 2px; border-radius: 2px;
padding: 3px 5px; padding: 3px 5px;
padding-right: 20px; padding-inline-end: 20px;
width: 100%; width: 100%;
transition: border-color 100ms ease-out; transition: border-color 100ms ease-out;
scrollbar-color: var(--button) var(--line); scrollbar-color: var(--button) var(--line);

View file

@ -43,7 +43,7 @@
.react-toggle-thumb { .react-toggle-thumb {
height: 16px; height: 16px;
width: 16px; width: 16px;
left: 0px; inset-inline-start: 0px;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
@ -57,7 +57,7 @@
background-color: var(--highlight); background-color: var(--highlight);
} }
.react-toggle-thumb { .react-toggle-thumb {
left: 34px - $offset-width; inset-inline-start: 34px - $offset-width;
border-color: var(--highlight); border-color: var(--highlight);
} }
} }

View file

@ -31,7 +31,7 @@
.listen { .listen {
position: absolute; position: absolute;
height: 16px; height: 16px;
right: 5px; inset-inline-end: 5px;
bottom: 5px; bottom: 5px;
} }
} }

View file

@ -41,9 +41,9 @@
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
margin-top: 1em; margin-top: 1em;
margin-right: 5px; margin-inline-end: 5px;
& > * { & > * {
margin-left: 10px; margin-inline-start: 10px;
} }
} }
} }