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" slow: "Slow"
fast: "Fast" fast: "Fast"
sensitiveMediaDetection: "Detection of NSFW media" sensitiveMediaDetection: "Detection of NSFW media"
autoDetect: "Auto detect"
localOnly: "Local only" localOnly: "Local only"
remoteOnly: "Remote only" remoteOnly: "Remote only"
failedToUpload: "Upload failed" failedToUpload: "Upload failed"

View file

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