chore: auto detect -> suggest

This commit is contained in:
naskya 2023-11-17 17:17:46 +09:00
parent 558867dac5
commit 636cbee66b
No known key found for this signature in database
GPG key ID: 164DFF24E2D40139
2 changed files with 21 additions and 13 deletions

View file

@ -1015,7 +1015,6 @@ speed: "Speed"
slow: "Slow"
fast: "Fast"
sensitiveMediaDetection: "Detection of NSFW media"
autoDetect: "Auto detect"
localOnly: "Local only"
remoteOnly: "Remote only"
failedToUpload: "Upload failed"

View file

@ -709,19 +709,28 @@ function setVisibility() {
}
function setLanguage() {
const actions: Array<MenuItem> = [
{
text: i18n.ts.autoDetect,
danger: false,
active: false,
icon: `${icon("ph-magic-wand")}`,
action: () => {
language.value = detectLanguage(text.value) ?? language.value;
const actions: Array<MenuItem> = [];
const detectedLanguage = detectLanguage(text.value);
if (
detectedLanguage !== "" &&
detectedLanguage != null &&
detectedLanguage !== language.value
)
actions.push(
{
text: langmap[detectedLanguage].nativeName,
danger: false,
active: false,
icon: `${icon("ph-list-magnifying-glass")}`,
action: () => {
language.value = detectedLanguage;
},
},
},
null,
];
if (language.value)
null,
);
if (language.value != null)
actions.push({
text: langmap[language.value].nativeName,
danger: false,