diff --git a/.config/ags/i18n/i18n.js b/.config/ags/i18n/i18n.js
index fc4b4a7b..abb38a9b 100755
--- a/.config/ags/i18n/i18n.js
+++ b/.config/ags/i18n/i18n.js
@@ -1,56 +1,55 @@
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
import configOptions from "../modules/.configuration/user_options.js";
+const { langCode, Extra_logs } = configOptions.i18n
+const translations = {};
+
+let currentLanguage = langCode || getLanguageCode();
function getLanguageCode() {
- let langEnv = GLib.getenv('LANG') || GLib.getenv('LANGUAGE') || 'C.UTF-8'; // Assume the default value contains a dot
- let langCode = langEnv.split('.')[0]; // Split the string and get the first part
+ let langEnv = GLib.getenv('LANG') || GLib.getenv('LANGUAGE') || 'Default.';
+ let langCode = langEnv.split('.')[0];
return langCode;
}
-const translations = {};
-let currentLanguage = configOptions.i18n.langCode || getLanguageCode();
-
// Load language file
-async function loadLanguage(lang) {
+function loadLanguage(lang) {
if (!translations[lang]) {
try {
let filePath = `~/.config/ags/i18n/locales/${lang}.json`;
filePath = filePath.replace(/^~/, GLib.get_home_dir());
-
let file = Gio.File.new_for_path(filePath);
let [success, contents] = file.load_contents(null);
if (success) {
let decoder = new TextDecoder('utf-8');
let jsonString = decoder.decode(contents);
translations[lang] = JSON.parse(jsonString);
- } else {
- throw new Error(`Unable to load file: ${filePath}`);
}
} catch (error) {
- console.error(`Failed to load language file, language code: ${lang}:`, error);
- throw error;
+ if (Extra_logs || lang === "Default")
+ console.warn(`Failed to load language file, language code: ${lang}:\n`, error);
+ return;
}
}
- currentLanguage = lang;
-}
-
-// Get translation, if no corresponding value, return the key
-function getString(key) {
- if (!translations[currentLanguage]?.[key] && key) {
- console.log('Not found:' + key);
- }
- return translations[currentLanguage]?.[key] || key;
+ currentLanguage = currentLanguage || lang;
}
// Initialize default language
function init() {
try {
loadLanguage(currentLanguage);
- console.log("初始化完成");
+ if (Extra_logs)
+ console.log(getString("Initialization complete!") || "Initialization complete!");
+ loadLanguage("Default");
} catch (error) {
console.error('Failed to initialize default language:', error);
}
}
+// Get translation, if no corresponding value, return the key
+function getString(key) {
+ if (key && !translations[currentLanguage]?.[key] && Extra_logs)
+ console.warn(`${translations[currentLanguage]["Not found"] || "Not found"}:::${key}`);
+ return translations[currentLanguage]?.[key] || translations['Default']?.[key] || key;
+}
export { getString, init };
\ No newline at end of file
diff --git a/.config/ags/i18n/locales/Default.json b/.config/ags/i18n/locales/Default.json
new file mode 100755
index 00000000..6ead42ca
--- /dev/null
+++ b/.config/ags/i18n/locales/Default.json
@@ -0,0 +1,232 @@
+{
+ "No media": "No media",
+ "Assistant": "Assistant",
+ "Powered by Google": "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.": "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.",
+ "Precise": "Precise",
+ "Balanced": "Balanced",
+ "Creative": "Creative",
+ "Gemini's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1": "Gemini's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1",
+ "Enhancements": "Enhancements",
+ "Tells Gemini:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points": "Tells Gemini:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points",
+ "Safety": "Safety",
+ "When turned off, tells the API (not the model) \nto not block harmful/explicit content": "When turned off, tells the API (not the model) \nto not block harmful/explicit content",
+ "History": "History",
+ "Saves chat history\nMessages in previous chats won't show automatically, but they are there": "Saves chat history\nMessages in previous chats won't show automatically, but they are there",
+ "Key stored in:": "Key stored in:",
+ "To update this key, type": "To update this key, type",
+ "Updated API Key at": "Updated API Key at",
+ "Currently using": "Currently using",
+ "Select ChatGPT-compatible API provider": "Select ChatGPT-compatible API provider",
+ "Official OpenAI API.\nPricing: Free for the first $5 or 3 months, whichever is less.": "Official OpenAI API.\nPricing: Free for the first $5 or 3 months, whichever is less.",
+ "Official Ollama API.\nPricing: Free.": "Official Ollama API.\nPricing: Free.",
+ "A unified interface for LLMs": "A unified interface for LLMs",
+ "An API from Tornado Softwares\nPricing: Free: 100/day\nRequires you to join their Discord for a key": "An API from Tornado Softwares\nPricing: Free: 100/day\nRequires you to join their Discord for a key",
+ "An API from @zukixa on GitHub.\nNote: Keys are IP-locked so it's buggy sometimes\nPricing: Free: 10/min, 800/day.\nRequires you to join their Discord for a key": "An API from @zukixa on GitHub.\nNote: Keys are IP-locked so it's buggy sometimes\nPricing: Free: 10/min, 800/day.\nRequires you to join their Discord for a key",
+ "Provider shown above": "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.": "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.",
+ "The model's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1": "The model's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1",
+ "An API key is required\nYou can grab one here, then enter it below": "An API key is required\nYou can grab one here, then enter it below",
+ "Tells the model:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points": "Tells the model:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points",
+ "Powered by waifu.im + other APIs": "Powered by waifu.im + other APIs",
+ "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.": "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.",
+ "Tags →": "Tags →",
+ "Invalid command.": "Invalid command.",
+ "Anime booru": "Anime booru",
+ "Powered by yande.re and konachan": "Powered by yande.re and 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.": "An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.",
+ "Lewds": "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}": "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}",
+ "Save in folder by tags": "Save in folder by tags",
+ "Saves images in folders by their tags": "Saves images in folders by their tags",
+ "Message Gemini...": "Message Gemini...",
+ "Enter Google AI API Key...": "Enter Google AI API Key...",
+ "Message the model...": "Message the model...",
+ "Enter API Key...": "Enter API Key...",
+ "Enter tags": "Enter tags",
+ "Quick scripts": "Quick scripts",
+ "Change screen resolution": "Change screen resolution",
+ "Update packages": "Update packages",
+ "Trim system generations to 5": "Trim system generations to 5",
+ "Trim home manager generations to 5": "Trim home manager generations to 5",
+ "Remove orphan packages": "Remove orphan packages",
+ "Uninstall unused flatpak packages": "Uninstall unused flatpak packages",
+ "Inaccurate Color picker": "Inaccurate Color picker",
+ "Result": "Result",
+ "Type to search": "Type to search",
+ "illogical-impulse": "illogical-impulse",
+ "RAM Usage": "RAM Usage",
+ "Swap Usage": "Swap Usage",
+ "CPU Usage": "CPU Usage",
+ "Uptime:": "Uptime:",
+ "Screen snip": "Screen snip",
+ "Color picker": "Color picker",
+ "Toggle on-screen keyboard": "Toggle on-screen keyboard",
+ "Night Light": "Night Light",
+ "Color inversion": "Color inversion",
+ "Keep system awake": "Keep system awake",
+ "Cloudflare WARP": "Cloudflare WARP",
+ "Session": "Session",
+ "Bluetooth | Right-click to configure": "Bluetooth | Right-click to configure",
+ "Wifi | Right-click to configure": "Wifi | Right-click to configure",
+ "Right-click to configure": "Right-click to configure",
+ "Unknown": "Unknown",
+ "Reload Environment config": "Reload Environment config",
+ "Open Settings": "Open Settings",
+ "Notifications": "Notifications",
+ "Audio controls": "Audio controls",
+ "Bluetooth": "Bluetooth",
+ "Wifi networks": "Wifi networks",
+ "Live config": "Live config",
+ "Silence": "Silence",
+ "Clear": "Clear",
+ "No notifications": "No notifications",
+ "notifications": "notifications",
+ "Close": "Close",
+ "Now": "Now",
+ "Yesterday": "Yesterday",
+ "No audio source": "No audio source",
+ "Remove device": "Remove device",
+ "Connected": "Connected",
+ "Paired": "Paired",
+ "More": "More",
+ "Selected": "Selected",
+ "Current network": "Current network",
+ "Authentication": "Authentication",
+ "Effects": "Effects",
+ "Transparency": "Transparency",
+ "[AGS]\nMake shell elements transparent\nBlur is also recommended if you enable this": "[AGS]\nMake shell elements transparent\nBlur is also recommended if you enable this",
+ "Blur": "Blur",
+ "[Hyprland]\nEnable blur on transparent elements\nDoesn't affect performance/power consumption unless you have transparent windows.": "[Hyprland]\nEnable blur on transparent elements\nDoesn't affect performance/power consumption unless you have transparent windows.",
+ "X-ray": "X-ray",
+ "[Hyprland]\nMake everything behind a window/layer except the wallpaper not rendered on its blurred surface\nRecommended to improve performance (if you don't abuse transparency/blur) ": "[Hyprland]\nMake everything behind a window/layer except the wallpaper not rendered on its blurred surface\nRecommended to improve performance (if you don't abuse transparency/blur) ",
+ "Size": "Size",
+ "[Hyprland]\nAdjust the blur radius. Generally doesn't affect performance\nHigher = more color spread": "[Hyprland]\nAdjust the blur radius. Generally doesn't affect performance\nHigher = more color spread",
+ "Passes": "Passes",
+ "[Hyprland] Adjust the number of runs of the blur algorithm\nMore passes = more spread and power consumption\n4 is recommended\n2- would look weird and 6+ would look lame.": "[Hyprland] Adjust the number of runs of the blur algorithm\nMore passes = more spread and power consumption\n4 is recommended\n2- would look weird and 6+ would look lame.",
+ "Animations": "Animations",
+ "[Hyprland] [GTK]\nEnable animations": "[Hyprland] [GTK]\nEnable animations",
+ "Choreography delay": "Choreography delay",
+ "In milliseconds, the delay between animations of a series": "In milliseconds, the delay between animations of a series",
+ "Developer": "Developer",
+ "Show FPS": "Show FPS",
+ "[Hyprland]\nShow FPS overlay on top-left corner": "[Hyprland]\nShow FPS overlay on top-left corner",
+ "Log to stdout": "Log to stdout",
+ "[Hyprland]\nPrint LOG, ERR, WARN, etc. messages to the console": "[Hyprland]\nPrint LOG, ERR, WARN, etc. messages to the console",
+ "Damage tracking": "Damage tracking",
+ "[Hyprland]\nEnable damage tracking\nGenerally, leave it on.\nTurn off only when a shader doesn't work": "[Hyprland]\nEnable damage tracking\nGenerally, leave it on.\nTurn off only when a shader doesn't work",
+ "Damage blink": "Damage blink",
+ "[Hyprland] [Epilepsy warning!]\nShow screen damage flashes": "[Hyprland] [Epilepsy warning!]\nShow screen damage flashes",
+ "Not all changes are saved": "Not all changes are saved",
+ "Mo": "Mo",
+ "Tu": "Tu",
+ "We": "We",
+ "Th": "Th",
+ "Fr": "Fr",
+ "Sa": "Sa",
+ "Su": "Su",
+ "Calendar": "Calendar",
+ "To Do": "To Do",
+ "Unfinished": "Unfinished",
+ "Done": "Done",
+ "Finished tasks will go here": "Finished tasks will go here",
+ "Nothing here!": "Nothing here!",
+ "+ New task": "+ New task",
+ "Add a task...": "Add a task...",
+ "Color scheme": "Color scheme",
+ "Options": "Options",
+ "Dark Mode": "Dark Mode",
+ "Ya should go to sleep!": "Ya should go to sleep!",
+ "Use Gradience": "Use Gradience",
+ "Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)",
+ "Scheme styles": "Scheme styles",
+ "Vibrant": "Vibrant",
+ "Vibrant+": "Vibrant+",
+ "Expressive": "Expressive",
+ "Monochrome": "Monochrome",
+ "Rainbow": "Rainbow",
+ "Fidelity": "Fidelity",
+ "Fruit Salad": "Fruit Salad",
+ "Tonal Spot": "Tonal Spot",
+ "Content": "Content",
+ "Use arrow keys to navigate.\nEnter to select, Esc to cancel.": "Use arrow keys to navigate.\nEnter to select, Esc to cancel.",
+ "Lock": "Lock",
+ "Logout": "Logout",
+ "Sleep": "Sleep",
+ "Hibernate": "Hibernate",
+ "Shutdown": "Shutdown",
+ "Reboot": "Reboot",
+ "Cancel": "Cancel",
+ "Cheat sheet": "Cheat sheet",
+ "Keybinds": "Keybinds",
+ "Periodic table": "Periodic table",
+ "Essentials for beginners": "Essentials for beginners",
+ "Make shell elements transparent": "Make shell elements transparent",
+ "Actions": "Actions",
+ "Window management": "Window management",
+ "Window arrangement": "Window arrangement",
+ "Workspace management": "Workspace management",
+ "Workspace navigation": "Workspace navigation",
+ "Widgets": "Widgets",
+ "Media": "Media",
+ "Apps": "Apps",
+ "Neutral": "Neutral",
+ "Launch foot (terminal)": "Launch foot (terminal)",
+ "Open app launcher": "Open app launcher",
+ "Change wallpaper": "Change wallpaper",
+ "Clipboard history >> clipboard": "Clipboard history >> clipboard",
+ "Pick emoji >> clipboard": "Pick emoji >> clipboard",
+ "Screen snip >> edit": "Screen snip >> edit",
+ "Screen snip to text >> clipboard": "Screen snip to text >> clipboard",
+ "Pick color (Hex) >> clipboard": "Pick color (Hex) >> clipboard",
+ "Screenshot >> clipboard": "Screenshot >> clipboard",
+ "Screenshot >> clipboard & file": "Screenshot >> clipboard & file",
+ "Record region (no sound)": "Record region (no sound)",
+ "Record screen (with sound)": "Record screen (with sound)",
+ "Suspend system": "Suspend system",
+ "Move focus in direction": "Move focus in direction",
+ "Move window": "Move window",
+ "Resize window": "Resize window",
+ "Close window": "Close window",
+ "Pick and kill a window": "Pick and kill a window",
+ "Window: move in direction": "Window: move in direction",
+ "Window: split ratio +/- 0.1": "Window: split ratio +/- 0.1",
+ "Float/unfloat window": "Float/unfloat window",
+ "Toggle fake fullscreen": "Toggle fake fullscreen",
+ "Toggle fullscreen": "Toggle fullscreen",
+ "Toggle maximization": "Toggle maximization",
+ "Focus workspace # (1, 2, 3, 4, ...)": "Focus workspace # (1, 2, 3, 4, ...)",
+ "Workspace: focus left/right": "Workspace: focus left/right",
+ "Workspace: toggle special": "Workspace: toggle special",
+ "Window: move to workspace # (1, 2, 3, 4, ...)": "Window: move to workspace # (1, 2, 3, 4, ...)",
+ "Window: move to workspace left/right": "Window: move to workspace left/right",
+ "Window: move to workspace special": "Window: move to workspace special",
+ "Window: pin (show on all workspaces)": "Window: pin (show on all workspaces)",
+ "Restart widgets": "Restart widgets",
+ "Cycle bar mode (normal, focus)": "Cycle bar mode (normal, focus)",
+ "Toggle overview/launcher": "Toggle overview/launcher",
+ "Show cheatsheet": "Show cheatsheet",
+ "Toggle left sidebar": "Toggle left sidebar",
+ "Toggle right sidebar": "Toggle right sidebar",
+ "Toggle music controls": "Toggle music controls",
+ "View color scheme and options": "View color scheme and options",
+ "Toggle power menu": "Toggle power menu",
+ "Toggle crosshair": "Toggle crosshair",
+ "Next track": "Next track",
+ "Previous track": "Previous track",
+ "Play/pause media": "Play/pause media",
+ "Launch Zed (editor)": "Launch Zed (editor)",
+ "Launch VSCode (editor)": "Launch VSCode (editor)",
+ "Launch Nautilus (file manager)": "Launch Nautilus (file manager)",
+ "Launch Firefox (browser)": "Launch Firefox (browser)",
+ "Launch GNOME Text Editor": "Launch GNOME Text Editor",
+ "Launch WPS Office": "Launch WPS Office",
+ "Launch GNOME Settings": "Launch GNOME Settings",
+ "Launch pavucontrol (volume mixer)": "Launch pavucontrol (volume mixer)",
+ "Launch EasyEffects (equalizer & other audio effects)": "Launch EasyEffects (equalizer & other audio effects)",
+ "Launch GNOME System monitor": "Launch GNOME System monitor",
+ "Toggle fallback launcher: anyrun": "Toggle fallback launcher: anyrun",
+ "Toggle fallback launcher: fuzzel": "Toggle fallback launcher: fuzzel",
+ "Initialization complete!": "Initialization complete!",
+ "Not found": "Not found:"
+}
\ No newline at end of file
diff --git a/.config/ags/i18n/locales/zh_CN.json b/.config/ags/i18n/locales/zh_CN.json
index 98dbc9f4..b5e67692 100755
--- a/.config/ags/i18n/locales/zh_CN.json
+++ b/.config/ags/i18n/locales/zh_CN.json
@@ -226,5 +226,7 @@
"Launch EasyEffects (equalizer & other audio effects)": "启动EasyEffects(均衡器和其他音频效果)",
"Launch GNOME System monitor": "启动GNOME系统监视器",
"Toggle fallback launcher: anyrun": "切换备用启动器:anyrun",
- "Toggle fallback launcher: fuzzel": "切换备用启动器:fuzzel"
+ "Toggle fallback launcher: fuzzel": "切换备用启动器:fuzzel",
+ "Initialization complete!": "初始化完成!",
+ "Not found": "未找到:"
}
\ No newline at end of file
diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js
index 8e4bb278..46fe3abb 100644
--- a/.config/ags/modules/.configuration/user_options.js
+++ b/.config/ags/modules/.configuration/user_options.js
@@ -71,6 +71,7 @@ let configOptions = {
},
'i18n': {
'langCode': "",//Customize the locale, such as zh_CN
+ 'Extra_logs': true
},
'monitors': {
'scaleMethod': "division", // Either "division" [default] or "gdk"