Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
ca2ebc89
Commit
ca2ebc89
authored
Oct 24, 2022
by
xmodar
Committed by
AUTOMATIC1111
Oct 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RTL languages support and improved Arabic localization
parent
df0a1f83
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
551 additions
and
691 deletions
+551
-691
localization.js
javascript/localization.js
+19
-1
ar_AR.json
localizations/ar_AR.json
+455
-690
ja_JP.json
localizations/ja_JP.json
+1
-0
ko_KR.json
localizations/ko_KR.json
+1
-0
ru_RU.json
localizations/ru_RU.json
+1
-0
style.css
style.css
+74
-0
No files found.
javascript/localization.js
View file @
ca2ebc89
...
@@ -107,7 +107,7 @@ function processNode(node){
...
@@ -107,7 +107,7 @@ function processNode(node){
}
}
function
dumpTranslations
(){
function
dumpTranslations
(){
dumped
=
{}
dumped
=
{
rtl
:
localization
.
rtl
||
false
}
Object
.
keys
(
original_lines
).
forEach
(
function
(
text
){
Object
.
keys
(
original_lines
).
forEach
(
function
(
text
){
if
(
dumped
[
text
]
!==
undefined
)
return
if
(
dumped
[
text
]
!==
undefined
)
return
...
@@ -129,6 +129,24 @@ onUiUpdate(function(m){
...
@@ -129,6 +129,24 @@ onUiUpdate(function(m){
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
processNode
(
gradioApp
())
processNode
(
gradioApp
())
if
(
localization
.
rtl
)
{
// if the language is from right to left,
(
new
MutationObserver
((
mutations
,
observer
)
=>
{
// wait for the style to load
mutations
.
forEach
(
mutation
=>
{
mutation
.
addedNodes
.
forEach
(
node
=>
{
if
(
node
.
tagName
===
'STYLE'
)
{
observer
.
disconnect
();
for
(
const
x
of
node
.
sheet
.
rules
)
{
// find all rtl media rules
if
(
Array
.
from
(
x
.
media
||
[]).
includes
(
'rtl'
))
{
x
.
media
.
appendMedium
(
'all'
);
// enable them
}
}
}
})
});
})).
observe
(
gradioApp
(),
{
childList
:
true
});
}
})
})
function
download_localization
()
{
function
download_localization
()
{
...
...
localizations/ar_AR.json
View file @
ca2ebc89
This source diff could not be displayed because it is too large. You can
view the blob
instead.
localizations/ja_JP.json
View file @
ca2ebc89
{
{
"rtl"
:
false
,
"⤡"
:
"⤡"
,
"⤡"
:
"⤡"
,
"⊞"
:
"⊞"
,
"⊞"
:
"⊞"
,
"×"
:
"×"
,
"×"
:
"×"
,
...
...
localizations/ko_KR.json
View file @
ca2ebc89
{
{
"rtl"
:
false
,
"×"
:
"×"
,
"×"
:
"×"
,
"•"
:
"•"
,
"•"
:
"•"
,
"⊞"
:
"⊞"
,
"⊞"
:
"⊞"
,
...
...
localizations/ru_RU.json
View file @
ca2ebc89
{
{
"rtl"
:
false
,
"⤡"
:
"⤡"
,
"⤡"
:
"⤡"
,
"⊞"
:
"⊞"
,
"⊞"
:
"⊞"
,
"×"
:
"×"
,
"×"
:
"×"
,
...
...
style.css
View file @
ca2ebc89
...
@@ -515,3 +515,77 @@ img2maskimg, #img2maskimg > .h-60, #img2maskimg > .h-60 > div, #img2maskimg > .h
...
@@ -515,3 +515,77 @@ img2maskimg, #img2maskimg > .h-60, #img2maskimg > .h-60 > div, #img2maskimg > .h
max-height
:
480px
!important
;
max-height
:
480px
!important
;
min-height
:
480px
!important
;
min-height
:
480px
!important
;
}
}
/* The following handles localization for right-to-left (RTL) languages like Arabic.
The rtl media type will only be activated by the logic in javascript/localization.js.
If you change anything above, you need to make sure it is RTL compliant by just running
your changes through converters like https://cssjanus.github.io/ or https://rtlcss.com/.
Then, you will need to add the RTL counterpart only if needed in the rtl section below.*/
@media
rtl
{
/* this part was manualy added */
:host
{
direction
:
rtl
;
}
.output-html
:has
(
.performance
),
.gr-text-input
{
direction
:
ltr
;
}
.gr-radio
,
.gr-checkbox
{
margin-left
:
0.25em
;
}
/* this part was automatically generated with few manual modifications */
.performance
.time
{
margin-right
:
unset
;
margin-left
:
0
;
}
.justify-center.overflow-x-scroll
{
justify-content
:
right
;
}
.justify-center.overflow-x-scroll
button
:first-of-type
{
margin-left
:
unset
;
margin-right
:
auto
;
}
.justify-center.overflow-x-scroll
button
:last-of-type
{
margin-right
:
unset
;
margin-left
:
auto
;
}
#settings
fieldset
span
.text-gray-500
,
#settings
.gr-block.gr-box
span
.text-gray-500
,
#settings
label
.block
span
{
margin-right
:
unset
;
margin-left
:
8em
;
}
#txt2img_progressbar
,
#img2img_progressbar
,
#ti_progressbar
{
right
:
unset
;
left
:
0
;
}
.progressDiv
.progress
{
padding
:
0
0
0
8px
;
text-align
:
left
;
}
#lightboxModal
{
left
:
unset
;
right
:
0
;
}
.modalPrev
,
.modalNext
{
border-radius
:
3px
0
0
3px
;
}
.modalNext
{
right
:
unset
;
left
:
0
;
border-radius
:
0
3px
3px
0
;
}
#imageARPreview
{
left
:
unset
;
right
:
0px
;
}
#txt2img_skip
,
#img2img_skip
{
right
:
unset
;
left
:
0px
;
}
#context-menu
{
box-shadow
:
-1px
1px
2px
#CE6400
;
}
.gr-box
>
div
>
div
>
input
.gr-text-input
{
right
:
unset
;
left
:
0.5em
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment