forked from Shinonome/dots-hyprland
ai-generated ui translations
This commit is contained in:
@@ -41,6 +41,7 @@ Singleton {
|
||||
property string defaultAiPrompts: Quickshell.shellPath("defaults/ai/prompts")
|
||||
property string userAiPrompts: FileUtils.trimFileProtocol(`${Directories.shellConfig}/ai/prompts`)
|
||||
property string aiChats: FileUtils.trimFileProtocol(`${Directories.state}/user/ai/chats`)
|
||||
property string aiTranslationScriptPath: FileUtils.trimFileProtocol(`${Directories.scriptPath}/ai/gemini-translate.sh`)
|
||||
// Cleanup on init
|
||||
Component.onCompleted: {
|
||||
Quickshell.execDetached(["mkdir", "-p", `${shellConfig}`])
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick.Layouts
|
||||
import qs.services
|
||||
import qs.modules.common
|
||||
@@ -8,6 +9,12 @@ import qs.modules.common.widgets
|
||||
ContentPage {
|
||||
forceWidth: true
|
||||
|
||||
Process {
|
||||
id: translationProc
|
||||
property string locale: ""
|
||||
command: [Directories.aiTranslationScriptPath, translationProc.locale]
|
||||
}
|
||||
|
||||
ContentSection {
|
||||
icon: "volume_up"
|
||||
title: Translation.tr("Audio")
|
||||
@@ -126,15 +133,39 @@ ContentPage {
|
||||
displayName: Translation.tr("Auto (System)"),
|
||||
value: "auto"
|
||||
},
|
||||
...Translation.availableLanguages.map(lang => {
|
||||
...Translation.allAvailableLanguages.map(lang => {
|
||||
return {
|
||||
displayName: lang.replace('_', '-'),
|
||||
displayName: lang,
|
||||
value: lang
|
||||
};
|
||||
})
|
||||
]
|
||||
}
|
||||
}
|
||||
ContentSubsection {
|
||||
title: Translation.tr("Generate translation with Gemini")
|
||||
|
||||
ConfigRow {
|
||||
MaterialTextArea {
|
||||
id: localeInput
|
||||
Layout.fillWidth: true
|
||||
placeholderText: Translation.tr("Locale code, e.g. fr_FR, de_DE, zh_CN...")
|
||||
text: Config.options.language.ui === "auto" ? Qt.locale().name : Config.options.language.ui
|
||||
}
|
||||
RippleButtonWithIcon {
|
||||
id: generateTranslationBtn
|
||||
Layout.fillHeight: true
|
||||
nerdIcon: ""
|
||||
enabled: !translationProc.running || (translationProc.locale !== localeInput.text.trim())
|
||||
mainText: enabled ? Translation.tr("Generate\nTypically takes 2 minutes") : Translation.tr("Generating...\nDon't close this window!")
|
||||
onClicked: {
|
||||
translationProc.locale = localeInput.text.trim();
|
||||
translationProc.running = false;
|
||||
translationProc.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ContentSection {
|
||||
|
||||
Reference in New Issue
Block a user