Add left sidebar translation

This commit is contained in:
月月
2024-09-15 16:10:30 +08:00
parent 1e3f49a3f8
commit 73334862c6
13 changed files with 132 additions and 100 deletions
+7 -6
View File
@@ -17,6 +17,7 @@ const TextView = Widget.subclass(Gtk.TextView, "AgsTextView");
import { widgetContent } from './sideleft.js';
import { IconTabContainer } from '../.commonwidgets/tabcontainer.js';
import { getString } from '../../i18n/i18n.js';
const EXPAND_INPUT_THRESHOLD = 30;
const APILIST = {
@@ -26,7 +27,7 @@ const APILIST = {
contentWidget: geminiView,
commandBar: geminiCommands,
tabIcon: geminiTabIcon,
placeholderText: 'Message Gemini...',
placeholderText: getString('Message Gemini...'),
},
'gpt': {
name: 'Assistant (GPTs)',
@@ -34,7 +35,7 @@ const APILIST = {
contentWidget: chatGPTView,
commandBar: chatGPTCommands,
tabIcon: chatGPTTabIcon,
placeholderText: 'Message the model...',
placeholderText: getString('Message the model...'),
},
'waifu': {
name: 'Waifus',
@@ -42,7 +43,7 @@ const APILIST = {
contentWidget: waifuView,
commandBar: waifuCommands,
tabIcon: waifuTabIcon,
placeholderText: 'Enter tags',
placeholderText: getString('Enter tags'),
},
'booru': {
name: 'Booru',
@@ -50,7 +51,7 @@ const APILIST = {
contentWidget: booruView,
commandBar: booruCommands,
tabIcon: booruTabIcon,
placeholderText: 'Enter tags',
placeholderText: getString('Enter tags'),
},
}
const APIS = userOptions.sidebar.pages.apis.order.map((apiName) => APILIST[apiName]);
@@ -83,11 +84,11 @@ export const chatEntry = TextView({
})
.hook(GPTService, (self) => {
if (APIS[currentApiId].name != 'Assistant (GPTs)') return;
self.placeholderText = (GPTService.key.length > 0 ? 'Message the model...' : 'Enter API Key...');
self.placeholderText = (GPTService.key.length > 0 ? getString('Message the model...') : getString('Enter API Key...'));
}, 'hasKey')
.hook(Gemini, (self) => {
if (APIS[currentApiId].name != 'Assistant (Gemini Pro)') return;
self.placeholderText = (Gemini.key.length > 0 ? 'Message Gemini...' : 'Enter Google AI API Key...');
self.placeholderText = (Gemini.key.length > 0 ? getString('Message Gemini...') : getString('Enter Google AI API Key...'));
}, 'hasKey')
.on("key-press-event", (widget, event) => {
// Don't send when Shift+Enter