forked from Shinonome/dots-hyprland
Add left sidebar translation
This commit is contained in:
@@ -35,19 +35,10 @@ async function loadLanguage(lang) {
|
||||
currentLanguage = lang;
|
||||
}
|
||||
|
||||
// Set the current language
|
||||
function setLanguage(lang) {
|
||||
try {
|
||||
loadLanguage(lang);
|
||||
} catch (error) {
|
||||
console.error(`Failed to set language, language code: ${lang}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
// Get translation, if no corresponding value, return the key
|
||||
function setString(key) {
|
||||
function getString(key) {
|
||||
if (!translations[currentLanguage]?.[key]) {
|
||||
console.log('无:' + key);
|
||||
console.log('Not found:' + key);
|
||||
}
|
||||
return translations[currentLanguage]?.[key] || key;
|
||||
}
|
||||
@@ -63,7 +54,4 @@ function init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export { setString, init, setLanguage };
|
||||
export { getString, init };
|
||||
@@ -1,11 +1,53 @@
|
||||
{
|
||||
"No media": "无媒体活动",
|
||||
"Options": "选项",
|
||||
"Dark Mode": "深色模式",
|
||||
"Close": "关闭",
|
||||
"Keybinds": "按键绑定",
|
||||
"Periodic table": "周期表",
|
||||
"Cheat sheet": "备忘单",
|
||||
"notifications": "通知",
|
||||
"Clear": "清除"
|
||||
"Clear": "清除",
|
||||
"Assistant": "助手",
|
||||
"Powered by Google": "由谷歌提供技术支持",
|
||||
"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.": "使用 gemini-pro\n不隶属于、不受谷歌赞助或支持。\n\n隐私:聊天信息不会与你的账户关联。\n但会被人类审阅者阅读,用于改进模型。",
|
||||
"Precise": "精确",
|
||||
"Balanced": "平衡",
|
||||
"Creative": "创意",
|
||||
"Gemini's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1": "Gemini的temperature值\n 精确 = 0\n 平衡 = 0.5\n 创意 = 1",
|
||||
"Enhancements": "增强功能",
|
||||
"Tells Gemini:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points": "告诉 Gemini:\n- 这是一个 Linux 侧边栏助手\n- 简洁明了,使用项目符号",
|
||||
"Safety": "安全",
|
||||
"When turned off, tells the API (not the model) \nto not block harmful/explicit content": "当关闭时,告诉API(而不是模型)\n不要屏蔽有害/显露的内容",
|
||||
"History": "历史",
|
||||
"Saves chat history\nMessages in previous chats won't show automatically, but they are there": "保存聊天历史\n以前聊天中的消息不会自动显示,但它们仍然存在",
|
||||
"Key stored in:": "密钥值储存在:",
|
||||
"To update this key, type": "要更新此密钥,请输入",
|
||||
"Updated API Key at": "更新了 API 密钥于",
|
||||
"Currently using": "当前使用",
|
||||
"Select ChatGPT-compatible API provider": "选择与 ChatGPT 兼容的 API 提供商",
|
||||
"Provider shown above": "上述显示的提供商",
|
||||
"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.": "使用 gpt-3.5-turbo。\n与 OpenAI 无关联,未获得其认可或赞助。\n\n隐私:OpenAI 声明,当您使用他们的 API 时,他们不会使用您的数据。\n我不清楚其他人的情况。",
|
||||
"The model's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1": "模型的temperature值。\n 精确 = 0\n 平衡 = 0.5\n 创意 = 1",
|
||||
"An API key is required\nYou can grab one <u>here</u>, then enter it below": "需要 API 密钥\n您可以在<u>这里</u>获取一个,然后在下面输入",
|
||||
"Tells the model:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points": "告诉模型:\n- 它是一个 Linux 侧边栏助手\n- 保持简洁并使用子弹点",
|
||||
"Powered by waifu.im + other APIs": "由 waifu.im + 其他 API 提供支持",
|
||||
"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.": "输入标签以获取随机图片。\n除非您明确请求,否则不会返回 NSFW 内容。\n\n免责声明:与提供商无关联\n也不对他们的任何内容负责。",
|
||||
"Tags →": "标签 →",
|
||||
"Invalid command.": "无效命令。",
|
||||
"Anime booru": "动漫 Booru",
|
||||
"Powered by yande.re and konachan": "由 yande.re 和 konachan 提供支持",
|
||||
"An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.": "一个图片 Booru。可能包含 NSFW 内容。\n小心。\n\n免责声明:与提供商无关联\n也不对它的任何内容负责。",
|
||||
"Lewds": "不雅内容",
|
||||
"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}": "启用时显示不雅内容。\n你喜欢这些?添加到 user_options.js 中:\n'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}",
|
||||
"Save in folder by tags": "按标签保存到文件夹",
|
||||
"Saves images in folders by their tags": "按标签将图片保存到文件夹中",
|
||||
"Message Gemini...": "向Gemini发消息...",
|
||||
"Enter Google AI API Key...": "输入 Google AI API 密钥...",
|
||||
"Message the model...": "给模型发消息...",
|
||||
"Enter API Key...": "输入 API 密钥...",
|
||||
"Enter tags": "输入标签",
|
||||
"Quick scripts": "快速脚本",
|
||||
"Change screen resolution": "更改屏幕分辨率",
|
||||
"Update packages": "更新程序包",
|
||||
"Trim system generations to 5": "将 system 代数修剪为 5",
|
||||
"Trim home manager generations to 5": "将 home manager 代数修剪为 5",
|
||||
"Remove orphan packages": "移除孤儿包",
|
||||
"Uninstall unused flatpak packages": "卸载未使用的 Flatpak 包",
|
||||
"<span strikethrough=\"true\">Inaccurate</span> Color picker": "<span strikethrough=\"true\">不准确</span> 颜色选择器",
|
||||
"Result": "结果",
|
||||
"illogical-impulse": "illogical-impulse"
|
||||
}
|
||||
+2
-3
@@ -2,9 +2,8 @@ import GLib from 'gi://GLib';
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js'
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'
|
||||
import { darkMode } from './modules/.miscutils/system.js';
|
||||
|
||||
export const COMPILED_STYLE_DIR = `${GLib.get_user_cache_dir()}/ags/user/generated`
|
||||
|
||||
// i18n_init();
|
||||
globalThis['handleStyles'] = (resetMusic) => {
|
||||
// Reset
|
||||
Utils.exec(`mkdir -p "${GLib.get_user_state_dir()}/ags/scss"`);
|
||||
@@ -15,7 +14,7 @@ globalThis['handleStyles'] = (resetMusic) => {
|
||||
// Generate overrides
|
||||
let lightdark = darkMode.value ? "dark" : "light";
|
||||
Utils.writeFileSync(
|
||||
`@mixin symbolic-icon {
|
||||
`@mixin symbolic-icon {
|
||||
-gtk-icon-theme: '${userOptions.icons.symbolicIconTheme[lightdark]}';
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -145,7 +145,7 @@ export default () => {
|
||||
if (mpris)
|
||||
label.label = `${trimTrackTitle(mpris.trackTitle)} • ${mpris.trackArtists.join(', ')}`;
|
||||
else
|
||||
label.label = 'No media';
|
||||
label.label = getString('No media');
|
||||
}),
|
||||
})
|
||||
const musicStuff = Box({
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,6 +12,7 @@ import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
|
||||
|
||||
import { ColorPickerSelection, hslToHex, hslToRgbValues, hexToHSL } from './color.js';
|
||||
import { clamp } from '../../.miscutils/mathfuncs.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
export default () => {
|
||||
const selectedColor = new ColorPickerSelection();
|
||||
@@ -174,7 +175,7 @@ export default () => {
|
||||
css: `background-color: ${hslToHex(selectedColor.hue, selectedColor.xAxis, selectedColor.yAxis / (1 + selectedColor.xAxis / 100))};`,
|
||||
children: [Label({
|
||||
className: 'txt txt-small',
|
||||
label: 'Result',
|
||||
label: getString('Result'),
|
||||
}),],
|
||||
attribute: {
|
||||
update: (self) => {
|
||||
@@ -269,7 +270,7 @@ export default () => {
|
||||
})
|
||||
return SidebarModule({
|
||||
icon: MaterialIcon('colorize', 'norm'),
|
||||
name: '<span strikethrough="true">Inaccurate</span> Color picker',
|
||||
name: getString('<span strikethrough="true">Inaccurate</span> Color picker'),
|
||||
revealChild: false,
|
||||
child: Box({
|
||||
className: 'spacing-h-5',
|
||||
|
||||
@@ -3,6 +3,7 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
const { execAsync, exec } = Utils;
|
||||
const { Box, Button, CenterBox, EventBox, Icon, Label, Scrollable } = Widget;
|
||||
|
||||
@@ -10,7 +11,7 @@ export default () => Box({
|
||||
className: 'txt sidebar-module techfont',
|
||||
children: [
|
||||
Label({
|
||||
label: 'illogical-impulse'
|
||||
label: getString('illogical-impulse')
|
||||
}),
|
||||
Box({ hexpand: true }),
|
||||
Button({
|
||||
|
||||
@@ -9,53 +9,54 @@ import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
|
||||
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
|
||||
|
||||
import { distroID, isArchDistro, isDebianDistro, hasFlatpak } from '../../.miscutils/system.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
const scripts = [
|
||||
{
|
||||
icon: 'desktop-symbolic',
|
||||
name: 'Change screen resolution',
|
||||
command: `bash ${App.configDir}/modules/sideleft/tools/changeres.sh`,
|
||||
enabled: true,
|
||||
},
|
||||
icon: 'desktop-symbolic',
|
||||
name: getString('Change screen resolution'),
|
||||
command: `bash ${App.configDir}/modules/sideleft/tools/changeres.sh`,
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
icon: 'nixos-symbolic',
|
||||
name: 'Trim system generations to 5',
|
||||
name: getString('Trim system generations to 5'),
|
||||
command: `sudo ${App.configDir}/scripts/quickscripts/nixos-trim-generations.sh 5 0 system`,
|
||||
enabled: distroID == 'nixos',
|
||||
},
|
||||
{
|
||||
icon: 'nixos-symbolic',
|
||||
name: 'Trim home manager generations to 5',
|
||||
name: getString('Trim home manager generations to 5'),
|
||||
command: `${App.configDir}/scripts/quickscripts/nixos-trim-generations.sh 5 0 home-manager`,
|
||||
enabled: distroID == 'nixos',
|
||||
},
|
||||
{
|
||||
icon: 'ubuntu-symbolic',
|
||||
name: 'Update packages',
|
||||
name: getString('Update packages'),
|
||||
command: `sudo apt update && sudo apt upgrade -y`,
|
||||
enabled: isDebianDistro,
|
||||
},
|
||||
{
|
||||
icon: 'fedora-symbolic',
|
||||
name: 'Update packages',
|
||||
name: getString('Update packages'),
|
||||
command: `sudo dnf upgrade -y`,
|
||||
enabled: distroID == 'fedora',
|
||||
},
|
||||
{
|
||||
icon: 'arch-symbolic',
|
||||
name: 'Update packages',
|
||||
name: getString('Update packages'),
|
||||
command: `sudo pacman -Syyu`,
|
||||
enabled: isArchDistro,
|
||||
},
|
||||
{
|
||||
icon: 'arch-symbolic',
|
||||
name: 'Remove orphan packages',
|
||||
name: getString('Remove orphan packages'),
|
||||
command: `sudo pacman -R $(pacman -Qdtq)`,
|
||||
enabled: isArchDistro,
|
||||
},
|
||||
{
|
||||
icon: 'flatpak-symbolic',
|
||||
name: 'Uninstall unused flatpak packages',
|
||||
name: getString('Uninstall unused flatpak packages'),
|
||||
command: `flatpak uninstall --unused`,
|
||||
enabled: hasFlatpak,
|
||||
},
|
||||
@@ -63,7 +64,7 @@ const scripts = [
|
||||
|
||||
export default () => SidebarModule({
|
||||
icon: MaterialIcon('code', 'norm'),
|
||||
name: 'Quick scripts',
|
||||
name: getString('Quick scripts'),
|
||||
child: Box({
|
||||
vertical: true,
|
||||
className: 'spacing-v-5',
|
||||
|
||||
@@ -5,7 +5,7 @@ import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
||||
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
const { exec, execAsync } = Utils;
|
||||
import { init as i18n_init, setLanguage as i18n_setLanguage } from './i18n/i18n.js'
|
||||
import { init as i18n_init, getString } from './i18n/i18n.js'
|
||||
//init i18n, Load language file
|
||||
i18n_init()
|
||||
// i18n_setLanguage('zh_CN') //Manual configuration
|
||||
@@ -18,7 +18,7 @@ export const showColorScheme = Variable(false, {})
|
||||
globalThis['openMusicControls'] = showMusicControls;
|
||||
globalThis['openColorScheme'] = showColorScheme;
|
||||
globalThis['mpris'] = Mpris;
|
||||
|
||||
globalThis['getString'] = getString
|
||||
// load monitor shell modes from userOptions
|
||||
const initialMonitorShellModes = () => {
|
||||
const numberOfMonitors = Gdk.Display.get_default()?.get_n_monitors() || 1;
|
||||
|
||||
Reference in New Issue
Block a user