Skip to content

Commit

Permalink
Merge pull request #26 from oscfdezdz/po
Browse files Browse the repository at this point in the history
po: rewrite some strings and mark as translatable
  • Loading branch information
lachhebo authored Jan 25, 2022
2 parents bf5827e + f54342d commit 43ef52b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
5 changes: 4 additions & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
@@ -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
8 changes: 5 additions & 3 deletions src/event_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from gi.repository import Gtk

import gi
import gettext

gi.require_version("Gtk", "3.0")
_ = gettext.gettext


class EventMachine:
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
(
Expand Down
8 changes: 6 additions & 2 deletions src/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
import gi
import musicbrainzngs as mb

import gettext

from .extension_manager import is_extension_managed
from .selection_handler import SELECTION

gi.require_version("Gtk", "3.0")

from gi.repository import Gtk # noqa: E402

_ = gettext.gettext


def remove_extension(filename: str):
"""
Expand Down Expand Up @@ -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)

Expand Down
14 changes: 9 additions & 5 deletions src/treeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 43ef52b

Please sign in to comment.