diff --git a/po/POTFILES b/po/POTFILES index bd118f8..ba99337 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,6 +1,9 @@ data/com.github.lachhebo.Gabtag.desktop.in data/com.github.lachhebo.Gabtag.appdata.xml.in data/com.github.lachhebo.Gabtag.gschema.xml -src/window.ui +src/event_machine.py src/main.py +src/tools.py +src/treeview.py +src/window.ui src/window_gtk.py diff --git a/src/event_machine.py b/src/event_machine.py index f9e1d67..b1d6ea4 100644 --- a/src/event_machine.py +++ b/src/event_machine.py @@ -8,8 +8,10 @@ from gi.repository import Gtk import gi +import gettext gi.require_version("Gtk", "3.0") +_ = gettext.gettext class EventMachine: @@ -47,10 +49,10 @@ def on_about_clicked(self, widget): def on_open_clicked(self, widget): self.is_real_selection = 0 dialog = Gtk.FileChooserDialog( - "Please choose a folder", + _("Select Folder"), self.window, Gtk.FileChooserAction.SELECT_FOLDER, - (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Select", Gtk.ResponseType.OK), + (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, _("Select"), Gtk.ResponseType.OK), ) dialog.set_default_size(800, 400) @@ -107,7 +109,7 @@ def on_load_cover_clicked(self, widget): self.is_real_selection = 0 dialog = Gtk.FileChooserDialog( - "Please choose a file", + _("Open File"), self.window, Gtk.FileChooserAction.OPEN, ( diff --git a/src/tools.py b/src/tools.py index 089766a..3c4c1f0 100644 --- a/src/tools.py +++ b/src/tools.py @@ -4,6 +4,8 @@ import gi import musicbrainzngs as mb +import gettext + from .extension_manager import is_extension_managed from .selection_handler import SELECTION @@ -11,6 +13,8 @@ from gi.repository import Gtk # noqa: E402 +_ = gettext.gettext + def remove_extension(filename: str): """ @@ -102,12 +106,12 @@ def music_length_to_string(length): def add_filters(dialog): filter_png = Gtk.FileFilter() - filter_png.set_name("Png") + filter_png.set_name(_("PNG images")) filter_png.add_mime_type("image/png") dialog.add_filter(filter_png) filter_jpeg = Gtk.FileFilter() - filter_jpeg.set_name("jpeg") + filter_jpeg.set_name(_("JPEG images")) filter_jpeg.add_mime_type("image/jpeg") dialog.add_filter(filter_jpeg) diff --git a/src/treeview.py b/src/treeview.py index deaf246..0c25e03 100644 --- a/src/treeview.py +++ b/src/treeview.py @@ -3,8 +3,12 @@ import gi from gi.repository import Gtk +import gettext + gi.require_version("Gtk", "3.0") +_ = gettext.gettext + class TreeView: def __init__(self, store, view): @@ -17,12 +21,12 @@ def add_columns(self): renderer_filename = Gtk.CellRendererText() column_filename = Gtk.TreeViewColumn( - "filename", renderer_filename, text=0, weight=2, weight_set=True + _("Name"), renderer_filename, text=0, weight=2, weight_set=True ) renderer_data = Gtk.CellRendererText() column_data_gathered = Gtk.TreeViewColumn( - "data gathered", renderer_data, text=1, weight=2, weight_set=True + _("Data"), renderer_data, text=1, weight=2, weight_set=True ) self.view.append_column(column_data_gathered) @@ -37,7 +41,7 @@ def update_tree_view_list(self, file_names: List): self.store.clear() for name_file in file_names: - self.store.append([name_file, "No", 400]) + self.store.append([name_file, _("No"), 400]) def manage_crawled(self, name_files, add=True): line_number = -1 @@ -54,9 +58,9 @@ def manage_crawled(self, name_files, add=True): path = Gtk.TreePath(line_number) list_iterator = self.store.get_iter(path) if add: - self.store.set_value(list_iterator, 1, "Yes") + self.store.set_value(list_iterator, 1, _("Yes")) else: - self.store.set_value(list_iterator, 1, "No") + self.store.set_value(list_iterator, 1, _("No")) def manage_bold_font(self, name_files, add=True): line_number = -1