Remove unnecessary imports,

Add some translations
This commit is contained in:
月月
2024-10-01 22:40:55 +08:00
parent ed9bcd7664
commit 10b3ead8b3
23 changed files with 44 additions and 46 deletions
@@ -6,7 +6,6 @@ const { Box, EventBox, Icon, Overlay, Label, Button, Revealer } = Widget;
import { MaterialIcon } from './materialicon.js';
import { setupCursorHover } from "../.widgetutils/cursorhover.js";
import { AnimatedCircProg } from "./cairo_circularprogress.js";
import { getString } from '../../i18n/i18n.js';
function guessMessageType(summary) {
const str = summary.toLowerCase();
@@ -70,8 +70,8 @@ let configOptions = {
},
},
'i18n': {
'langCode': "",//Customize the locale, such as zh_CN
'Extra_logs': true
'langCode': "",//Customize the locale, such as zh_CN,Optional value references "~/.config/ags/i18n/locales/"
'extraLogs': false
},
'monitors': {
'scaleMethod': "division", // Either "division" [default] or "gdk"
-1
View File
@@ -8,7 +8,6 @@ import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { AnimatedCircProg } from "../../.commonwidgets/cairo_circularprogress.js";
import { WWO_CODE, WEATHER_SYMBOL, NIGHT_WEATHER_SYMBOL } from '../../.commondata/weather.js';
import { getString } from '../../../i18n/i18n.js';
const WEATHER_CACHE_FOLDER = `${GLib.get_user_cache_dir()}/ags/weather`;
Utils.exec(`mkdir -p ${WEATHER_CACHE_FOLDER}`);
+7 -8
View File
@@ -11,7 +11,6 @@ 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();
@@ -213,17 +212,17 @@ const BooruPage = (taglist, serviceName = 'Booru') => {
children: [
Box({ hexpand: true }),
ImageAction({
name: 'Go to file url',
name: getString('Go to file url'),
icon: 'file_open',
action: () => execAsync(['xdg-open', `${data.file_url}`]).catch(print),
}),
ImageAction({
name: 'Go to source',
name: getString('Go to source'),
icon: 'open_in_new',
action: () => execAsync(['xdg-open', `${data.source}`]).catch(print),
}),
ImageAction({
name: 'Save image',
name: getString('Save image'),
icon: 'save',
action: (self) => {
const currentTags = BooruService.queries.at(-1).realTagList.filter(tag => !tag.includes('rating:'));
@@ -259,10 +258,10 @@ const BooruPage = (taglist, serviceName = 'Booru') => {
transition: 'slide_up_down',
transitionDuration: userOptions.animations.durationSmall,
children: {
'api': PageState('api', 'Calling API'),
'download': PageState('downloading', 'Downloading image'),
'done': PageState('done', 'Finished!'),
'error': PageState('error', 'Error'),
'api': PageState('api', getString('Calling API')),
'download': PageState('downloading', getString('Downloading image')),
'done': PageState('done', getString('Finished!')),
'error': PageState('error', getString('Error')),
},
});
const downloadIndicator = MarginRevealer({
+1 -2
View File
@@ -12,7 +12,6 @@ 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',
@@ -122,7 +121,7 @@ const GPTInfo = () => {
className: 'txt txt-title-small sidebar-chat-welcome-txt',
wrap: true,
justify: Gtk.Justification.CENTER,
label: `${getString("Assistant")} (GPTs)`,
label: `Assistant (GPTs)`,
}),
Box({
className: 'spacing-h-5',
+1 -2
View File
@@ -11,7 +11,6 @@ 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`;
@@ -35,7 +34,7 @@ const GeminiInfo = () => {
className: 'txt txt-title-small sidebar-chat-welcome-txt',
wrap: true,
justify: Gtk.Justification.CENTER,
label: `${getString('Assistant')} (Gemini)`,
label: `Assistant (Gemini)`,
}),
Box({
className: 'spacing-h-5',
+8 -9
View File
@@ -13,7 +13,6 @@ 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}`])
@@ -124,11 +123,11 @@ const WaifuImage = (taglist) => {
transition: 'slide_up_down',
transitionDuration: userOptions.animations.durationSmall,
children: {
'api': ImageState('api', 'Calling API'),
'download': ImageState('downloading', 'Downloading image'),
'done': ImageState('done', 'Finished!'),
'error': ImageState('error', 'Error'),
'notfound': ImageState('error', 'Not found!'),
'api': ImageState('api', getString('Calling API')),
'download': ImageState('downloading', getString('Downloading image')),
'done': ImageState('done', getString('Finished!')),
'error': ImageState('error', getString('Error')),
'notfound': ImageState('error', getString('Not found!')),
},
});
const downloadIndicator = MarginRevealer({
@@ -157,12 +156,12 @@ const WaifuImage = (taglist) => {
children: [
Box({ hexpand: true }),
ImageAction({
name: 'Go to source',
name: getString('Go to source'),
icon: 'link',
action: () => execAsync(['xdg-open', `${thisBlock.attribute.imageData.source}`]).catch(print),
}),
ImageAction({
name: 'Hoard',
name: getString('Hoard'),
icon: 'save',
action: (self) => {
execAsync(['bash', '-c', `mkdir -p $(xdg-user-dir PICTURES)/homework${thisBlock.attribute.isNsfw ? '/🌶️' : ''} && cp ${thisBlock.attribute.imagePath} $(xdg-user-dir PICTURES)/homework${thisBlock.attribute.isNsfw ? '/🌶️/' : ''}`])
@@ -171,7 +170,7 @@ const WaifuImage = (taglist) => {
},
}),
ImageAction({
name: 'Open externally',
name: getString('Open externally'),
icon: 'open_in_new',
action: () => execAsync([IMAGE_VIEWER_APP, `${thisBlock.attribute.imagePath}`]).catch(print),
}),
@@ -17,7 +17,6 @@ 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 = {
@@ -12,7 +12,6 @@ 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();
@@ -3,7 +3,6 @@ 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;
@@ -9,7 +9,6 @@ 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 = [
{
@@ -7,7 +7,6 @@ import { setupCursorHover } from '../.widgetutils/cursorhover.js';
import { TodoWidget } from "./todolist.js";
import { getCalendarLayout } from "./calendar_layout.js";
import { getString } from '../../i18n/i18n.js';
let calendarJson = getCalendarLayout(undefined, true);
let monthshift = 0;
@@ -5,7 +5,6 @@ const { Box, Button, Icon, Label, Revealer, Scrollable, Slider, Stack } = Widget
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import { iconExists } from '../../.miscutils/icons.js';
import { getString } from '../../../i18n/i18n.js';
const AppVolume = (stream) => Box({
className: 'sidebar-volmixer-stream spacing-h-10',
@@ -6,7 +6,6 @@ const { execAsync, exec } = Utils;
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import { ConfigToggle } from '../../.commonwidgets/configwidgets.js';
import { getString } from '../../../i18n/i18n.js';
// can't connect: sync_problem
@@ -7,7 +7,6 @@ const { execAsync, exec } = Utils;
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import { ConfigGap, ConfigSpinButton, ConfigToggle } from '../../.commonwidgets/configwidgets.js';
import { getString } from '../../../i18n/i18n.js';
const HyprlandToggle = ({ icon, name, desc = null, option, enableValue = 1, disableValue = 0, extraOnChange = () => { } }) => ConfigToggle({
icon: icon,
@@ -8,7 +8,6 @@ import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import Notification from '../../.commonwidgets/notification.js';
import { ConfigToggle } from '../../.commonwidgets/configwidgets.js';
import { getString } from '../../../i18n/i18n.js';
export default (props) => {
const notifEmptyContent = Box({
@@ -6,7 +6,6 @@ const { execAsync, exec } = Utils;
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import { ConfigToggle } from '../../.commonwidgets/configwidgets.js';
import { getString } from '../../../i18n/i18n.js';
const MATERIAL_SYMBOL_SIGNAL_STRENGTH = {
'network-wireless-signal-excellent-symbolic': "signal_wifi_4_bar",
@@ -10,7 +10,6 @@ import { BluetoothIndicator, NetworkIndicator } from '../.commonwidgets/statusic
import { setupCursorHover } from '../.widgetutils/cursorhover.js';
import { MaterialIcon } from '../.commonwidgets/materialicon.js';
import { sidebarOptionsStack } from './sideright.js';
import { getString } from '../../i18n/i18n.js';
export const ToggleIconWifi = (props = {}) => Widget.Button({
className: 'txt-small sidebar-iconbutton',
@@ -25,7 +25,6 @@ import { getDistroIcon } from '../.miscutils/system.js';
import { MaterialIcon } from '../.commonwidgets/materialicon.js';
import { ExpandingIconTabContainer } from '../.commonwidgets/tabcontainer.js';
import { checkKeybind } from '../.widgetutils/keybind.js';
import { getString } from '../../i18n/i18n.js';
const centerWidgets = [
{
@@ -5,7 +5,6 @@ import { MaterialIcon } from '../.commonwidgets/materialicon.js';
import { TabContainer } from '../.commonwidgets/tabcontainer.js';
import Todo from "../../services/todo.js";
import { setupCursorHover } from '../.widgetutils/cursorhover.js';
import { getString } from '../../i18n/i18n.js';
const TodoListItem = (task, id, isDone, isEven = false) => {
const taskName = Widget.Label({