Skip to content

Commit efdc75d

Browse files
committed
Fix localization in KeybindingWidgets.py
Fixes linuxmint/cinnamon-spices-applets#4235
1 parent af9be76 commit efdc75d

2 files changed

Lines changed: 34 additions & 27 deletions

File tree

cinnamon.pot

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-01-05 21:46+0200\n"
11+
"POT-Creation-Date: 2026-01-05 22:02+0200\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -89,7 +89,7 @@ msgstr ""
8989
#: files/usr/share/cinnamon/cinnamon-settings-users/cinnamon-settings-users.py:385
9090
#: files/usr/share/cinnamon/cinnamon-settings-users/cinnamon-settings-users.py:451
9191
#: files/usr/share/cinnamon/cinnamon-settings-users/cinnamon-settings-users.py:656
92-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:331
92+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:155
9393
#: files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py:762
9494
#: files/usr/share/cinnamon/cinnamon-settings/modules/cs_startup.py:771
9595
msgid "Cancel"
@@ -3824,67 +3824,69 @@ msgstr ""
38243824
msgid "Choose the assignment you wish to keep. The others will be cleared."
38253825
msgstr ""
38263826

3827-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:146
3827+
#. l10n constants - get them translated here so they use Cinnamon's gettext
3828+
#. context
3829+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:147
38283830
msgid "Click to set a new accelerator key."
38293831
msgstr ""
38303832

3831-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:147
3833+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:148
38323834
msgid "Press Escape or click again to cancel the operation."
38333835
msgstr ""
38343836

3835-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:148
3837+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:149
38363838
msgid "Press Backspace to clear the existing keybinding."
38373839
msgstr ""
38383840

3839-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:183
3841+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:150
38403842
msgid "unassigned"
38413843
msgstr ""
38423844

3843-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:227
3845+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:151
38443846
msgid "Pick an accelerator"
38453847
msgstr ""
38463848

3847-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:332
3848-
msgid "Continue"
3849-
msgstr ""
3850-
3851-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:336
3849+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:152
38523850
#, python-format
38533851
msgid ""
38543852
"\n"
38553853
"This key combination, '<b>%s</b>' should not be used because it would become impossible to type using this key. "
38563854
msgstr ""
38573855

3858-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:337
3856+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:153
38593857
msgid ""
38603858
"Please try again using a modifier key such as Control, Alt or Super (Windows key).\n"
38613859
"\n"
38623860
msgstr ""
38633861

3864-
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:338
3862+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:154
38653863
msgid ""
38663864
"Continue only if you are certain this is what you want, otherwise press "
38673865
"cancel.\n"
38683866
msgstr ""
38693867

3870-
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:176
3868+
#: files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py:156
3869+
msgid "Continue"
3870+
msgstr ""
3871+
3872+
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:179
38713873
msgid "Checking dependencies"
38723874
msgstr ""
38733875

3874-
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:177
3876+
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:180
38753877
#, python-format
38763878
msgid "Please install: %s"
38773879
msgstr ""
38783880

3879-
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:376
3881+
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:379
38803882
msgid "_Cancel"
38813883
msgstr ""
38823884

3883-
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:377
3885+
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:380
38843886
msgid "_Open"
38853887
msgstr ""
38863888

3887-
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:390
3889+
#: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py:393
38883890
msgid "Sound files"
38893891
msgstr ""
38903892

files/usr/share/cinnamon/cinnamon-settings/bin/KeybindingWidgets.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,17 @@ class CellRendererKeybinding(Gtk.CellRendererText):
143143
GObject.ParamFlags.READWRITE)
144144
}
145145

146+
# l10n constants - get them translated here so they use Cinnamon's gettext context
146147
TOOLTIP_TEXT = "%s\n%s\n%s" % (_("Click to set a new accelerator key."),
147148
_("Press Escape or click again to cancel the operation."),
148149
_("Press Backspace to clear the existing keybinding."))
150+
UNASSIGNED = _("unassigned")
151+
PICK_AN_ACCELERATOR = _("Pick an accelerator")
152+
MSG = _("\nThis key combination, \'<b>%s</b>\' should not be used because it would become impossible to type using this key. ")
153+
MSG += _("Please try again using a modifier key such as Control, Alt or Super (Windows key).\n\n")
154+
MSG += _("Continue only if you are certain this is what you want, otherwise press cancel.\n")
155+
CANCEL = _("Cancel")
156+
CONTINUE = _("Continue")
149157

150158
def __init__(self, a_widget, accel_string=None):
151159
super(CellRendererKeybinding, self).__init__()
@@ -180,7 +188,7 @@ def do_set_property(self, prop, value):
180188
raise AttributeError(f'unknown property {prop.name}')
181189

182190
def update_label(self):
183-
text = _("unassigned") if self.default_value else self.text_string
191+
text = CellRendererKeybinding.UNASSIGNED if self.default_value else self.text_string
184192
if self.accel_string:
185193
restore_atab = False
186194
restore_keyboard = False
@@ -224,7 +232,7 @@ def editing_started(self, renderer, editable, path):
224232
Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK,
225233
None, Gdk.CURRENT_TIME)
226234

227-
editable.set_text(_("Pick an accelerator"))
235+
editable.set_text(CellRendererKeybinding.PICK_AN_ACCELERATOR)
228236
self.accel_editable = editable
229237

230238
self.release_event_id = self.accel_editable.connect( "key-release-event", self.on_key_release )
@@ -328,15 +336,12 @@ def on_key_release(self, widget, event):
328336
Gtk.MessageType.WARNING,
329337
Gtk.ButtonsType.NONE,
330338
None)
331-
button = dialog.add_button(_("Cancel"), Gtk.ResponseType.CANCEL)
332-
button = dialog.add_button(_("Continue"), Gtk.ResponseType.OK)
339+
button = dialog.add_button(CellRendererKeybinding.CANCEL, Gtk.ResponseType.CANCEL)
340+
button = dialog.add_button(CellRendererKeybinding.CONTINUE, Gtk.ResponseType.OK)
333341
dialog.set_default_response(Gtk.ResponseType.CANCEL)
334342
button.get_style_context().add_class(Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION)
335343
dialog.set_default_size(400, 200)
336-
msg = _("\nThis key combination, \'<b>%s</b>\' should not be used because it would become impossible to type using this key. ")
337-
msg += _("Please try again using a modifier key such as Control, Alt or Super (Windows key).\n\n")
338-
msg += _("Continue only if you are certain this is what you want, otherwise press cancel.\n")
339-
dialog.set_markup(msg % accel_label)
344+
dialog.set_markup(CellRendererKeybinding.MSG % accel_label)
340345
dialog.show_all()
341346
response = dialog.run()
342347
dialog.destroy()

0 commit comments

Comments
 (0)