feat: add German translation
This commit is contained in:
@@ -1,12 +1,25 @@
|
|||||||
|
import locale
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from gi.repository import Nautilus, GObject
|
from gi.repository import Nautilus, GObject
|
||||||
|
|
||||||
|
TRANSLATIONS = {
|
||||||
|
"de": ("In Kitty öffnen", "Den Ordner in Kitty öffnen"),
|
||||||
|
"en": ("Open in Kitty", "Opens the current folder in Kitty"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class KittyNautilusExtension(GObject.GObject, Nautilus.MenuProvider):
|
class KittyNautilusExtension(GObject.GObject, Nautilus.MenuProvider):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
# Derive lang from the system locale
|
||||||
|
default_locale = locale.getdefaultlocale()[0].split("_")[0]
|
||||||
|
lang = default_locale.split("_")[0]
|
||||||
|
# Define a save fallback, if translation for the lang does not exist
|
||||||
|
if lang not in TRANSLATIONS:
|
||||||
|
lang = "en"
|
||||||
|
|
||||||
|
self.intl = TRANSLATIONS[lang]
|
||||||
|
|
||||||
def launch_kitty(self, menu: Nautilus.MenuItem, path):
|
def launch_kitty(self, menu: Nautilus.MenuItem, path):
|
||||||
subprocess.Popen(["kitty", "--working-directory", path], shell=False)
|
subprocess.Popen(["kitty", "--working-directory", path], shell=False)
|
||||||
@@ -14,8 +27,8 @@ class KittyNautilusExtension(GObject.GObject, Nautilus.MenuProvider):
|
|||||||
def make_item(self, name, path) -> Nautilus.MenuItem:
|
def make_item(self, name, path) -> Nautilus.MenuItem:
|
||||||
item = Nautilus.MenuItem(
|
item = Nautilus.MenuItem(
|
||||||
name=name,
|
name=name,
|
||||||
label="Open in Kitty",
|
label=self.intl[0],
|
||||||
tip="Open current folder in Kitty",
|
tip=self.intl[1],
|
||||||
icon="terminal",
|
icon="terminal",
|
||||||
)
|
)
|
||||||
item.connect("activate", self.launch_kitty, path)
|
item.connect("activate", self.launch_kitty, path)
|
||||||
|
|||||||
Reference in New Issue
Block a user