forked from Shinonome/dots-hyprland
ai-generated ui translations
This commit is contained in:
@@ -53,6 +53,12 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: translationProc
|
||||
property string locale: ""
|
||||
command: [Directories.aiTranslationScriptPath, translationProc.locale]
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
@@ -135,23 +141,56 @@ ApplicationWindow {
|
||||
icon: "language"
|
||||
title: Translation.tr("Language")
|
||||
|
||||
ConfigSelectionArray {
|
||||
id: languageSelector
|
||||
currentValue: Config.options.language.ui
|
||||
onSelected: newValue => {
|
||||
Config.options.language.ui = newValue;
|
||||
ContentSubsection {
|
||||
title: Translation.tr("Select language")
|
||||
ConfigSelectionArray {
|
||||
id: languageSelector
|
||||
currentValue: Config.options.language.ui
|
||||
onSelected: newValue => {
|
||||
Config.options.language.ui = newValue;
|
||||
}
|
||||
options: [
|
||||
{
|
||||
displayName: Translation.tr("Auto (System)"),
|
||||
value: "auto"
|
||||
},
|
||||
...Translation.allAvailableLanguages.map(lang => {
|
||||
return {
|
||||
displayName: lang,
|
||||
value: lang
|
||||
};
|
||||
})]
|
||||
}
|
||||
}
|
||||
|
||||
NoticeBox {
|
||||
Layout.fillWidth: true
|
||||
text: Translation.tr("Language not listed or incomplete translations?\nYou can choose to generate translations for it with Gemini.\n1. Open the left sidebar with Super+A, set model to Gemini (if it isn't already)\n2. Type /key, hit Enter and follow the instructions\n3. Type /key YOUR_API_KEY\n4. Type the locale of your language below and press Generate")
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
options: [
|
||||
{
|
||||
displayName: Translation.tr("Auto (System)"),
|
||||
value: "auto"
|
||||
},
|
||||
...Translation.availableLanguages.map(lang => {
|
||||
return {
|
||||
displayName: lang.replace('_', '-'),
|
||||
value: lang
|
||||
};
|
||||
})]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user