Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e4ecbef5 by Philipp Hörist at 2024-10-02T10:52:48+02:00
cfix: Translation: Add python format substitution again
- - - - -
3 changed files:
- gajim/common/util/user_strings.py
- gajim/gtk/roster_item_exchange.py
- test/common/test_get_uf_relative_time.py
Changes:
=====================================
gajim/common/util/user_strings.py
=====================================
@@ -135,7 +135,10 @@ def get_uf_relative_time(date_time: dt.datetime, now:
dt.datetime | None = None)
return _('Just now')
if timespan < dt.timedelta(minutes=15):
minutes = int(timespan.seconds / 60)
- return ngettext('%s min ago', '%s mins ago', minutes)
+ return ngettext(
+ '%(number)s min ago',
+ '%(number)s mins ago',
+ minutes) % {'number': minutes}
today = now.date()
if date_time.date() == today:
=====================================
gajim/gtk/roster_item_exchange.py
=====================================
@@ -215,9 +215,11 @@ def _on_accept_button_clicked(self, _button: Gtk.Button)
-> None:
groups=groups,
auto_auth=True)
iter_ = model.iter_next(iter_)
- InformationDialog(i18n.ngettext('Added %s contact',
- 'Added %s contacts',
- count))
+ InformationDialog(
+ i18n.ngettext('Added %(count)s contact',
+ 'Added %(count)s contacts',
+ count) % {'count': count}
+ )
elif self._action == 'modify':
count = 0
while iter_:
@@ -243,9 +245,11 @@ def _on_accept_button_clicked(self, _button: Gtk.Button)
-> None:
self._client.get_module('Presence').unsubscribe(jid)
self._client.get_module('Roster').delete_item(jid)
iter_ = model.iter_next(iter_)
- InformationDialog(i18n.ngettext('Removed %s contact',
- 'Removed %s contacts',
- count))
+ InformationDialog(
+ i18n.ngettext('Removed %(count)s contact',
+ 'Removed %(count)s contacts',
+ count) % {'count': count}
+ )
self.destroy()
def _on_cancel_button_clicked(self, _button: Gtk.Button) -> None:
=====================================
test/common/test_get_uf_relative_time.py
=====================================
@@ -27,23 +27,19 @@ def test_sub_15_minutes(self):
'''Test timedelta less than 15 minutes and more than 1 minute ago'''
timenow = datetime(2023, 1, 2, 3, 4, 0, tzinfo=local_timezone)
timestamp1 = timenow - timedelta(minutes=3)
- self.assertEqual(get_uf_relative_time(timestamp1,
- timenow),
- ngettext(
- '%s min ago',
- '%s mins ago',
- 3))
+ self.assertEqual(
+ get_uf_relative_time(timestamp1, timenow),
+ ngettext('%(number)s min ago', '%(number)s mins ago', 3) %
{'number': 3}
+ )
def test_sub_15_minutes_next_day(self):
'''Test timedelta less than 15 minutes and it is the next day'''
timenow = datetime(2023, 1, 1, 0, 5, 0, tzinfo=local_timezone)
timestamp1 = timenow - timedelta(minutes=10)
- self.assertEqual(get_uf_relative_time(timestamp1,
- timenow),
- ngettext(
- '%s min ago',
- '%s mins ago',
- 10))
+ self.assertEqual(
+ get_uf_relative_time(timestamp1, timenow),
+ ngettext('%(number)s min ago', '%(number)s mins ago', 10) %
{'number': 10}
+ )
def test_today(self):
'''Test today: same day and more than 15 minutes ago'''
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e4ecbef5d36157d34e0ebb9e7f73e11f57d4cf15
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e4ecbef5d36157d34e0ebb9e7f73e11f57d4cf15
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]