Bugfixes, translation
This commit is contained in:
@@ -17,7 +17,8 @@ const Gio = imports.gi.Gio;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const St = imports.gi.St;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const Gettext = imports.gettext;
|
||||
const GLib = imports.gi.GLib;
|
||||
|
||||
|
||||
/******************** Constants ********************/
|
||||
@@ -44,6 +45,15 @@ function CinnamonDynamicWallpaperExtension(uuid) {
|
||||
}
|
||||
|
||||
|
||||
function _(str) {
|
||||
let customTranslation = Gettext.dgettext(UUID, str);
|
||||
if (customTranslation !== str) {
|
||||
return customTranslation;
|
||||
}
|
||||
return Gettext.gettext(str);
|
||||
}
|
||||
|
||||
|
||||
CinnamonDynamicWallpaperExtension.prototype = {
|
||||
|
||||
/******************** Lifecycle ********************/
|
||||
@@ -56,12 +66,14 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
||||
_init: function(uuid) {
|
||||
this.settings = new Settings.ExtensionSettings(this, uuid);
|
||||
|
||||
Gettext.bindtextdomain(UUID, GLib.get_home_dir() + '/.local/share/locale');
|
||||
|
||||
// Check for the first startup
|
||||
if (this.settings.getValue("first_start")) {
|
||||
if (!this.settings.getValue("first_start")) {
|
||||
|
||||
// Welcome notification
|
||||
this.showNotification("Welcome to Cinnamon Dynamic Wallpaper",
|
||||
"Check the preferences to choose a dynamic wallpaper", true)
|
||||
this.showNotification(_("Welcome to Cinnamon Dynamic Wallpaper"),
|
||||
_("Check the preferences to choose a dynamic wallpaper"), true)
|
||||
|
||||
// Hide the notification on system restart
|
||||
this.settings.setValue("first_start", false)
|
||||
@@ -98,8 +110,8 @@ CinnamonDynamicWallpaperExtension.prototype = {
|
||||
try {
|
||||
Util.spawnCommandLine("/usr/bin/env python3 " + DIRECTORY.path + "/src/main.py loop")
|
||||
} catch(e) {
|
||||
this.showNotification("Error!",
|
||||
"Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub.")
|
||||
this.showNotification(_("Error!"),
|
||||
_("Cinnamon Dynamic Wallpaper got an error while running the loop script. Please create an issue on GitHub."))
|
||||
}
|
||||
|
||||
// Refresh every 60 seconds
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys, datetime
|
||||
import sys
|
||||
from view.main_window import *
|
||||
from model.main_view_model import *
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import os, time
|
||||
from PIL import Image
|
||||
# GTK
|
||||
from gi.repository import Gio, Gdk
|
||||
|
||||
# Packages
|
||||
import os, time, gi, locale
|
||||
from PIL import Image
|
||||
|
||||
# Local scripts
|
||||
from service.cinnamon_pref_handler import *
|
||||
from service.suntimes import *
|
||||
from service.time_bar_chart import *
|
||||
from service.location import *
|
||||
from enums.PeriodSourceEnum import *
|
||||
|
||||
|
||||
class Main_View_Model:
|
||||
""" The main ViewModel for the application
|
||||
"""
|
||||
@@ -38,6 +43,13 @@ class Main_View_Model:
|
||||
|
||||
self.background_settings = Gio.Settings.new("org.cinnamon.desktop.background")
|
||||
|
||||
|
||||
# Language support
|
||||
self.UUID = "cinnamon-dynamic-wallpaper@TobiZog"
|
||||
self.localeDir = os.path.expanduser("~") + "/.local/share/locale"
|
||||
locale.bindtextdomain(self.UUID, self.localeDir)
|
||||
|
||||
|
||||
# Other Variables
|
||||
self.display = Gdk.Display.get_default()
|
||||
self.screen_height = self.display.get_monitor(0).get_geometry().height
|
||||
|
||||
@@ -32,6 +32,7 @@ class Cinnamon_Pref_Handler:
|
||||
with open(self.pref_location, "r") as pref_file:
|
||||
self.pref_data = json.load(pref_file)
|
||||
|
||||
self.first_start = self.extract_json('first_start')
|
||||
self.picture_aspect = self.extract_json('picture_aspect')
|
||||
self.dynamic_background_color = self.extract_json('dynamic_background_color')
|
||||
self.image_source = self.extract_json('image_source')
|
||||
@@ -93,6 +94,7 @@ class Cinnamon_Pref_Handler:
|
||||
def store_preferences(self):
|
||||
""" Store the values of the Preference object to the JSON file
|
||||
"""
|
||||
self.value_to_json('first_start', self.first_start)
|
||||
self.value_to_json('picture_aspect', self.picture_aspect)
|
||||
self.value_to_json('dynamic_background_color', self.dynamic_background_color)
|
||||
self.value_to_json('image_source', self.image_source)
|
||||
|
||||
@@ -8,8 +8,8 @@ gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
|
||||
# Packages
|
||||
import subprocess, threading, time, locale
|
||||
from datetime import timedelta, datetime, date
|
||||
import subprocess, threading, time
|
||||
from datetime import timedelta, datetime
|
||||
|
||||
# Local scripts
|
||||
from model.main_view_model import *
|
||||
@@ -17,11 +17,6 @@ from view.dialogs import *
|
||||
from enums.ImageSourceEnum import *
|
||||
from enums.PeriodSourceEnum import *
|
||||
|
||||
UUID = "cinnamon-dynamic-wallpaper@TobiZog"
|
||||
|
||||
localeDir = os.path.expanduser("~") + "/.local/share/locale"
|
||||
locale.bindtextdomain(UUID, localeDir)
|
||||
|
||||
|
||||
class Main_Window:
|
||||
############################################################
|
||||
@@ -39,7 +34,7 @@ class Main_Window:
|
||||
|
||||
# Glade
|
||||
self.builder = Gtk.Builder()
|
||||
self.builder.set_translation_domain(UUID)
|
||||
self.builder.set_translation_domain(self.view_model.UUID)
|
||||
self.builder.add_from_file(self.view_model.GLADE_URI)
|
||||
self.builder.connect_signals(self)
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: cinnamon-dynamic-wallpaper@TobiZog 2.2\n"
|
||||
"Project-Id-Version: cinnamon-dynamic-wallpaper@TobiZog 2.3\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
|
||||
"extensions/issues\n"
|
||||
"POT-Creation-Date: 2024-02-11 19:14+0100\n"
|
||||
"POT-Creation-Date: 2024-02-12 12:12+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -17,7 +17,25 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: 5.4/extension.js:127
|
||||
#: 5.4/extension.js:75
|
||||
msgid "Welcome to Cinnamon Dynamic Wallpaper"
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:76
|
||||
msgid "Check the preferences to choose a dynamic wallpaper"
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:113
|
||||
msgid "Error!"
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:114
|
||||
msgid ""
|
||||
"Cinnamon Dynamic Wallpaper got an error while running the loop script. "
|
||||
"Please create an issue on GitHub."
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:139
|
||||
msgid "Open settings"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ msgstr ""
|
||||
"Project-Id-Version: cinnamon-dynamic-wallpaper@TobiZog 2.2\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
|
||||
"extensions/issues\n"
|
||||
"POT-Creation-Date: 2024-02-11 19:14+0100\n"
|
||||
"PO-Revision-Date: 2024-02-11 19:08+0100\n"
|
||||
"POT-Creation-Date: 2024-02-12 12:12+0100\n"
|
||||
"PO-Revision-Date: 2024-02-12 12:08+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: de\n"
|
||||
@@ -18,7 +18,27 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#: 5.4/extension.js:127
|
||||
#: 5.4/extension.js:75
|
||||
msgid "Welcome to Cinnamon Dynamic Wallpaper"
|
||||
msgstr "Willkommen zu Cinnamon Dynamic Wallpaper"
|
||||
|
||||
#: 5.4/extension.js:76
|
||||
msgid "Check the preferences to choose a dynamic wallpaper"
|
||||
msgstr "Öffne die Einstellungen und konfiguriere die Erweiterung"
|
||||
|
||||
#: 5.4/extension.js:113
|
||||
msgid "Error!"
|
||||
msgstr "Fehler!"
|
||||
|
||||
#: 5.4/extension.js:114
|
||||
msgid ""
|
||||
"Cinnamon Dynamic Wallpaper got an error while running the loop script. "
|
||||
"Please create an issue on GitHub."
|
||||
msgstr ""
|
||||
"Cinnamon Dynamic Wallpaper hat ein Problem beim Aufruf des loop-Skripts "
|
||||
"festgestellt. Bitte wende dich an den Entwickler via GitHub."
|
||||
|
||||
#: 5.4/extension.js:139
|
||||
msgid "Open settings"
|
||||
msgstr "Einstellungen öffnen"
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
|
||||
"extensions/issues\n"
|
||||
"POT-Creation-Date: 2024-02-11 19:14+0100\n"
|
||||
"PO-Revision-Date: 2024-02-11 19:28+0100\n"
|
||||
"POT-Creation-Date: 2024-02-12 12:12+0100\n"
|
||||
"PO-Revision-Date: 2024-02-11 19:51+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: es\n"
|
||||
@@ -18,7 +18,26 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#: 5.4/extension.js:127
|
||||
#: 5.4/extension.js:75
|
||||
#, fuzzy
|
||||
msgid "Welcome to Cinnamon Dynamic Wallpaper"
|
||||
msgstr "Fondo de pantalla dinámico de Cinnamon"
|
||||
|
||||
#: 5.4/extension.js:76
|
||||
msgid "Check the preferences to choose a dynamic wallpaper"
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:113
|
||||
msgid "Error!"
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:114
|
||||
msgid ""
|
||||
"Cinnamon Dynamic Wallpaper got an error while running the loop script. "
|
||||
"Please create an issue on GitHub."
|
||||
msgstr ""
|
||||
|
||||
#: 5.4/extension.js:139
|
||||
msgid "Open settings"
|
||||
msgstr "Abrir configuración"
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ msgstr ""
|
||||
"Project-Id-Version: cinnamon-dynamic-wallpaper@TobiZog 2.2\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
|
||||
"extensions/issues\n"
|
||||
"POT-Creation-Date: 2024-02-11 19:08+0100\n"
|
||||
"PO-Revision-Date: 2024-02-11 19:27+0100\n"
|
||||
"POT-Creation-Date: 2024-02-12 12:12+0100\n"
|
||||
"PO-Revision-Date: 2024-02-12 12:12+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: nl\n"
|
||||
@@ -18,7 +18,27 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#: 5.4/extension.js:127
|
||||
#: 5.4/extension.js:75
|
||||
msgid "Welcome to Cinnamon Dynamic Wallpaper"
|
||||
msgstr "Welkom op Cinnamon Dynamic Wallpaper"
|
||||
|
||||
#: 5.4/extension.js:76
|
||||
msgid "Check the preferences to choose a dynamic wallpaper"
|
||||
msgstr "Controleer de voorkeuren om een dynamische achtergrond te kiezen"
|
||||
|
||||
#: 5.4/extension.js:113
|
||||
msgid "Error!"
|
||||
msgstr "Fout!"
|
||||
|
||||
#: 5.4/extension.js:114
|
||||
msgid ""
|
||||
"Cinnamon Dynamic Wallpaper got an error while running the loop script. "
|
||||
"Please create an issue on GitHub."
|
||||
msgstr ""
|
||||
"Cinnamon Dynamic Wallpaper kreeg een fout tijdens het uitvoeren van het loop-"
|
||||
"script. Maak een ticket aan op GitHub."
|
||||
|
||||
#: 5.4/extension.js:139
|
||||
msgid "Open settings"
|
||||
msgstr "Instellingen openen"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user