forked from Shinonome/dots-hyprland
Add left sidebar translation
This commit is contained in:
@@ -11,6 +11,7 @@ import BooruService from '../../../services/booru.js';
|
||||
import { chatEntry } from '../apiwidgets.js';
|
||||
import { ConfigToggle } from '../../.commonwidgets/configwidgets.js';
|
||||
import { SystemMessage } from './ai_chatmessage.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
const IMAGE_REVEAL_DELAY = 13; // Some wait for inits n other weird stuff
|
||||
const USER_CACHE_DIR = GLib.get_user_cache_dir();
|
||||
@@ -67,12 +68,12 @@ const BooruInfo = () => {
|
||||
className: 'txt-smallie txt-subtext',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Powered by yande.re and konachan',
|
||||
label: getString('Powered by yande.re and konachan'),
|
||||
}),
|
||||
Button({
|
||||
className: 'txt-subtext txt-norm icon-material',
|
||||
label: 'info',
|
||||
tooltipText: 'An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.',
|
||||
tooltipText: getString('An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.'),
|
||||
setup: setupCursorHoverInfo,
|
||||
}),
|
||||
]
|
||||
@@ -95,13 +96,8 @@ export const BooruSettings = () => MarginRevealer({
|
||||
children: [
|
||||
ConfigToggle({
|
||||
icon: 'menstrual_health',
|
||||
name: 'Lewds',
|
||||
desc: `Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:
|
||||
'sidebar': {
|
||||
'image': {
|
||||
'allowNsfw': true,
|
||||
}
|
||||
},`,
|
||||
name: getString('Lewds'),
|
||||
desc: getString("Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}"),
|
||||
initValue: BooruService.nsfw,
|
||||
onChange: (self, newValue) => {
|
||||
BooruService.nsfw = newValue;
|
||||
@@ -112,8 +108,8 @@ export const BooruSettings = () => MarginRevealer({
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'sell',
|
||||
name: 'Save in folder by tags',
|
||||
desc: 'Saves images in folders by their tags',
|
||||
name: getString('Save in folder by tags'),
|
||||
desc: getString('Saves images in folders by their tags'),
|
||||
initValue: userOptions.sidebar.image.saveInFolderByTags,
|
||||
onChange: (self, newValue) => {
|
||||
userOptions.sidebar.image.saveInFolderByTags = newValue;
|
||||
@@ -469,7 +465,7 @@ export const booruCommands = Box({
|
||||
self.pack_start(Button({
|
||||
className: 'sidebar-chat-chip-toggle',
|
||||
setup: setupCursorHover,
|
||||
label: 'Tags →',
|
||||
label: getString('Tags →'),
|
||||
onClicked: () => {
|
||||
booruTags.revealChild = !booruTags.revealChild;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { markdownTest } from '../../.miscutils/md2pango.js';
|
||||
import { MarginRevealer } from '../../.widgethacks/advancedrevealers.js';
|
||||
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
|
||||
import { chatEntry } from '../apiwidgets.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
export const chatGPTTabIcon = Icon({
|
||||
hpack: 'center',
|
||||
@@ -53,7 +54,7 @@ const ProviderSwitcher = () => {
|
||||
}
|
||||
const indicatorChevron = MaterialIcon('expand_more', 'norm');
|
||||
const indicatorButton = Button({
|
||||
tooltipText: 'Select ChatGPT-compatible API provider',
|
||||
tooltipText: getString('Select ChatGPT-compatible API provider'),
|
||||
child: Box({
|
||||
className: 'spacing-h-10 txt',
|
||||
children: [
|
||||
@@ -121,7 +122,7 @@ const GPTInfo = () => {
|
||||
className: 'txt txt-title-small sidebar-chat-welcome-txt',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Assistant (GPTs)',
|
||||
label: `${getString("Assistant")} (GPTs)`,
|
||||
}),
|
||||
Box({
|
||||
className: 'spacing-h-5',
|
||||
@@ -131,12 +132,12 @@ const GPTInfo = () => {
|
||||
className: 'txt-smallie txt-subtext',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Provider shown above',
|
||||
label: getString('Provider shown above'),
|
||||
}),
|
||||
Button({
|
||||
className: 'txt-subtext txt-norm icon-material',
|
||||
label: 'info',
|
||||
tooltipText: 'Uses gpt-3.5-turbo.\nNot affiliated, endorsed, or sponsored by OpenAI.\n\nPrivacy: OpenAI claims they do not use your data\nwhen you use their API. Idk about others.',
|
||||
tooltipText: getString('Uses gpt-3.5-turbo.\nNot affiliated, endorsed, or sponsored by OpenAI.\n\nPrivacy: OpenAI claims they do not use your data\nwhen you use their API. Idk about others.'),
|
||||
setup: setupCursorHoverInfo,
|
||||
}),
|
||||
]
|
||||
@@ -164,11 +165,11 @@ const GPTSettings = () => MarginRevealer({
|
||||
hpack: 'center',
|
||||
icon: 'casino',
|
||||
name: 'Randomness',
|
||||
desc: 'The model\'s temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1',
|
||||
desc: getString('The model\'s temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1'),
|
||||
options: [
|
||||
{ value: 0.00, name: 'Precise', },
|
||||
{ value: 0.50, name: 'Balanced', },
|
||||
{ value: 1.00, name: 'Creative', },
|
||||
{ value: 0.00, name: getString('Precise'), },
|
||||
{ value: 0.50, name: getString('Balanced'), },
|
||||
{ value: 1.00, name: getString('Creative'), },
|
||||
],
|
||||
initIndex: 2,
|
||||
onChange: (value, name) => {
|
||||
@@ -183,8 +184,8 @@ const GPTSettings = () => MarginRevealer({
|
||||
children: [
|
||||
ConfigToggle({
|
||||
icon: 'model_training',
|
||||
name: 'Enhancements',
|
||||
desc: 'Tells the model:\n- It\'s a Linux sidebar assistant\n- Be brief and use bullet points',
|
||||
name: getString('Enhancements'),
|
||||
desc: getString('Tells the model:\n- It\'s a Linux sidebar assistant\n- Be brief and use bullet points'),
|
||||
initValue: GPTService.assistantPrompt,
|
||||
onChange: (self, newValue) => {
|
||||
GPTService.assistantPrompt = newValue;
|
||||
@@ -212,7 +213,7 @@ export const OpenaiApiKeyInstructions = () => Box({
|
||||
wrap: true,
|
||||
className: 'txt sidebar-chat-welcome-txt',
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'An API key is required\nYou can grab one <u>here</u>, then enter it below'
|
||||
label: getString('An API key is required\nYou can grab one <u>here</u>, then enter it below')
|
||||
}),
|
||||
setup: setupCursorHover,
|
||||
onClicked: () => {
|
||||
@@ -287,7 +288,7 @@ export const sendMessage = (text) => {
|
||||
// Commands
|
||||
if (text.startsWith('/')) {
|
||||
if (text.startsWith('/clear')) clearChat();
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`Currently using \`${GPTService.modelName}\``, '/model', chatGPTView))
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`${getString("Currently using")} \`${GPTService.modelName}\``, '/model', chatGPTView))
|
||||
else if (text.startsWith('/prompt')) {
|
||||
const firstSpaceIndex = text.indexOf(' ');
|
||||
const prompt = text.slice(firstSpaceIndex + 1);
|
||||
@@ -301,18 +302,18 @@ export const sendMessage = (text) => {
|
||||
else if (text.startsWith('/key')) {
|
||||
const parts = text.split(' ');
|
||||
if (parts.length == 1) chatContent.add(SystemMessage(
|
||||
`Key stored in:\n\`${GPTService.keyPath}\`\nTo update this key, type \`/key YOUR_API_KEY\``,
|
||||
`${getString("Key stored in:")}\n\`${GPTService.keyPath}\`\n${getString("To update this key, type")} \`/key YOUR_API_KEY\``,
|
||||
'/key',
|
||||
chatGPTView));
|
||||
else {
|
||||
GPTService.key = parts[1];
|
||||
chatContent.add(SystemMessage(`Updated API Key at\n\`${GPTService.keyPath}\``, '/key', chatGPTView));
|
||||
chatContent.add(SystemMessage(`${getString("Updated API Key at")}\n\`${GPTService.keyPath}\``, '/key', chatGPTView));
|
||||
}
|
||||
}
|
||||
else if (text.startsWith('/test'))
|
||||
chatContent.add(SystemMessage(markdownTest, `Markdown test`, chatGPTView));
|
||||
else
|
||||
chatContent.add(SystemMessage(`Invalid command.`, 'Error', chatGPTView))
|
||||
chatContent.add(SystemMessage(getString("Invalid command."), 'Error', chatGPTView))
|
||||
}
|
||||
else {
|
||||
GPTService.send(text);
|
||||
@@ -346,7 +347,7 @@ export const chatGPTView = Box({
|
||||
// Always scroll to bottom with new content
|
||||
const adjustment = scrolledWindow.get_vadjustment();
|
||||
adjustment.connect("changed", () => {
|
||||
if(!chatEntry.hasFocus) return;
|
||||
if (!chatEntry.hasFocus) return;
|
||||
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size());
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ConfigToggle, ConfigSegmentedSelection, ConfigGap } from '../../.common
|
||||
import { markdownTest } from '../../.miscutils/md2pango.js';
|
||||
import { MarginRevealer } from '../../.widgethacks/advancedrevealers.js';
|
||||
import { chatEntry } from '../apiwidgets.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
const MODEL_NAME = `Gemini`;
|
||||
|
||||
@@ -34,7 +35,7 @@ const GeminiInfo = () => {
|
||||
className: 'txt txt-title-small sidebar-chat-welcome-txt',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Assistant (Gemini)',
|
||||
label: `${getString('Assistant')} (Gemini)`,
|
||||
}),
|
||||
Box({
|
||||
className: 'spacing-h-5',
|
||||
@@ -44,12 +45,12 @@ const GeminiInfo = () => {
|
||||
className: 'txt-smallie txt-subtext',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Powered by Google',
|
||||
label: getString('Powered by Google'),
|
||||
}),
|
||||
Button({
|
||||
className: 'txt-subtext txt-norm icon-material',
|
||||
label: 'info',
|
||||
tooltipText: 'Uses gemini-pro.\nNot affiliated, endorsed, or sponsored by Google.\n\nPrivacy: Chat messages aren\'t linked to your account,\n but will be read by human reviewers to improve the model.',
|
||||
tooltipText: getString("Uses gemini-pro.\nNot affiliated, endorsed, or sponsored by Google.\n\nPrivacy: Chat messages aren't linked to your account,\n but will be read by human reviewers to improve the model."),
|
||||
setup: setupCursorHoverInfo,
|
||||
}),
|
||||
]
|
||||
@@ -77,11 +78,11 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
hpack: 'center',
|
||||
icon: 'casino',
|
||||
name: 'Randomness',
|
||||
desc: 'Gemini\'s temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1',
|
||||
desc: getString("Gemini's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1"),
|
||||
options: [
|
||||
{ value: 0.00, name: 'Precise', },
|
||||
{ value: 0.50, name: 'Balanced', },
|
||||
{ value: 1.00, name: 'Creative', },
|
||||
{ value: 0.00, name: getString('Precise'), },
|
||||
{ value: 0.50, name: getString('Balanced'), },
|
||||
{ value: 1.00, name: getString('Creative'), },
|
||||
],
|
||||
initIndex: 2,
|
||||
onChange: (value, name) => {
|
||||
@@ -96,8 +97,8 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
children: [
|
||||
ConfigToggle({
|
||||
icon: 'model_training',
|
||||
name: 'Enhancements',
|
||||
desc: 'Tells Gemini:\n- It\'s a Linux sidebar assistant\n- Be brief and use bullet points',
|
||||
name: getString('Enhancements'),
|
||||
desc: getString("Tells Gemini:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points"),
|
||||
initValue: GeminiService.assistantPrompt,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.assistantPrompt = newValue;
|
||||
@@ -105,8 +106,8 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'shield',
|
||||
name: 'Safety',
|
||||
desc: 'When turned off, tells the API (not the model) \nto not block harmful/explicit content',
|
||||
name: getString('Safety'),
|
||||
desc: getString("When turned off, tells the API (not the model) \nto not block harmful/explicit content"),
|
||||
initValue: GeminiService.safe,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.safe = newValue;
|
||||
@@ -114,8 +115,8 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'history',
|
||||
name: 'History',
|
||||
desc: 'Saves chat history\nMessages in previous chats won\'t show automatically, but they are there',
|
||||
name: getString('History'),
|
||||
desc: getString("Saves chat history\nMessages in previous chats won't show automatically, but they are there"),
|
||||
initValue: GeminiService.useHistory,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.useHistory = newValue;
|
||||
@@ -223,7 +224,7 @@ export const sendMessage = (text) => {
|
||||
clearChat();
|
||||
GeminiService.loadHistory();
|
||||
}
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`Currently using \`${GeminiService.modelName}\``, '/model', geminiView))
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`${getString("Currently using")} \`${GeminiService.modelName}\``, '/model', geminiView))
|
||||
else if (text.startsWith('/prompt')) {
|
||||
const firstSpaceIndex = text.indexOf(' ');
|
||||
const prompt = text.slice(firstSpaceIndex + 1);
|
||||
@@ -237,18 +238,18 @@ export const sendMessage = (text) => {
|
||||
else if (text.startsWith('/key')) {
|
||||
const parts = text.split(' ');
|
||||
if (parts.length == 1) chatContent.add(SystemMessage(
|
||||
`Key stored in:\n\`${GeminiService.keyPath}\`\nTo update this key, type \`/key YOUR_API_KEY\``,
|
||||
`${getString("Key stored in:")} \n\`${GeminiService.keyPath}\`\n${getString("To update this key, type")} \`/key YOUR_API_KEY\``,
|
||||
'/key',
|
||||
geminiView));
|
||||
else {
|
||||
GeminiService.key = parts[1];
|
||||
chatContent.add(SystemMessage(`Updated API Key at\n\`${GeminiService.keyPath}\``, '/key', geminiView));
|
||||
chatContent.add(SystemMessage(`${getString("Updated API Key at")}\n\`${GeminiService.keyPath}\``, '/key', geminiView));
|
||||
}
|
||||
}
|
||||
else if (text.startsWith('/test'))
|
||||
chatContent.add(SystemMessage(markdownTest, `Markdown test`, geminiView));
|
||||
else
|
||||
chatContent.add(SystemMessage(`Invalid command.`, 'Error', geminiView))
|
||||
chatContent.add(SystemMessage(getString(`Invalid command.`), 'Error', geminiView))
|
||||
}
|
||||
else {
|
||||
GeminiService.send(text);
|
||||
@@ -280,7 +281,7 @@ export const geminiView = Box({
|
||||
// Always scroll to bottom with new content
|
||||
const adjustment = scrolledWindow.get_vadjustment();
|
||||
adjustment.connect("changed", () => Utils.timeout(1, () => {
|
||||
if(!chatEntry.hasFocus) return;
|
||||
if (!chatEntry.hasFocus) return;
|
||||
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size());
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { setupCursorHover, setupCursorHoverInfo } from '../../.widgetutils/curso
|
||||
import WaifuService from '../../../services/waifus.js';
|
||||
import { darkMode } from '../../.miscutils/system.js';
|
||||
import { chatEntry } from '../apiwidgets.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
async function getImageViewerApp(preferredApp) {
|
||||
Utils.execAsync(['bash', '-c', `command -v ${preferredApp}`])
|
||||
@@ -71,12 +72,12 @@ const WaifuInfo = () => {
|
||||
className: 'txt-smallie txt-subtext',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Powered by waifu.im + other APIs',
|
||||
label: getString('Powered by waifu.im + other APIs'),
|
||||
}),
|
||||
Button({
|
||||
className: 'txt-subtext txt-norm icon-material',
|
||||
label: 'info',
|
||||
tooltipText: 'Type tags for a random pic.\nNSFW content will not be returned unless\nyou explicitly request such a tag.\n\nDisclaimer: Not affiliated with the providers\nnor responsible for any of their content.',
|
||||
tooltipText: getString('Type tags for a random pic.\nNSFW content will not be returned unless\nyou explicitly request such a tag.\n\nDisclaimer: Not affiliated with the providers\nnor responsible for any of their content.'),
|
||||
setup: setupCursorHoverInfo,
|
||||
}),
|
||||
]
|
||||
@@ -368,7 +369,7 @@ export const waifuCommands = Box({
|
||||
self.pack_start(Button({
|
||||
className: 'sidebar-chat-chip-toggle',
|
||||
setup: setupCursorHover,
|
||||
label: 'Tags →',
|
||||
label: getString('Tags →'),
|
||||
onClicked: () => {
|
||||
waifuTags.revealChild = !waifuTags.revealChild;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user