Tooltip localization support
This commit is contained in:
parent
22bcc7be42
commit
57a3d146e3
|
@ -117,16 +117,16 @@ titles = {
|
|||
|
||||
onUiUpdate(function(){
|
||||
gradioApp().querySelectorAll('span, button, select, p').forEach(function(span){
|
||||
tooltip = titles[span.textContent];
|
||||
tooltip = localization[titles[span.textContent]] || titles[span.textContent];
|
||||
|
||||
if(!tooltip){
|
||||
tooltip = titles[span.value];
|
||||
tooltip = localization[titles[span.value]] || titles[span.value];
|
||||
}
|
||||
|
||||
if(!tooltip){
|
||||
for (const c of span.classList) {
|
||||
if (c in titles) {
|
||||
tooltip = titles[c];
|
||||
tooltip = localization[titles[c]] || titles[c];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ onUiUpdate(function(){
|
|||
if (select.onchange != null) return;
|
||||
|
||||
select.onchange = function(){
|
||||
select.title = titles[select.value] || "";
|
||||
select.title = localization[titles[select.value]] || titles[select.value] || "";
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue