feat: add German translation
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
import locale
|
||||
import os
|
||||
import subprocess
|
||||
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):
|
||||
|
||||
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):
|
||||
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:
|
||||
item = Nautilus.MenuItem(
|
||||
name=name,
|
||||
label="Open in Kitty",
|
||||
tip="Open current folder in Kitty",
|
||||
label=self.intl[0],
|
||||
tip=self.intl[1],
|
||||
icon="terminal",
|
||||
)
|
||||
item.connect("activate", self.launch_kitty, path)
|
||||
|
||||
Reference in New Issue
Block a user