Daniel Brötzmann pushed to branch i18n-method-switch at gajim / gajim
Commits:
-
b69d7b2e
by Philipp Hörist at 2022-12-04T19:33:59+01:00
-
156b23cf
by Philipp Hörist at 2022-12-04T19:38:45+01:00
-
9294172c
by Philipp Hörist at 2022-12-04T20:19:38+01:00
-
5c874f20
by Philipp Hörist at 2022-12-04T20:46:57+01:00
-
b48e6922
by Philipp Hörist at 2022-12-04T20:56:07+01:00
-
16ce9f7e
by Philipp Hörist at 2022-12-04T21:39:40+01:00
-
5265a80c
by wurstsalat at 2022-12-04T22:56:12+01:00
25 changed files:
- gajim/common/const.py
- gajim/common/ged.py
- gajim/common/helpers.py
- gajim/common/i18n.py
- gajim/common/modules/mam.py
- gajim/common/modules/message.py
- gajim/common/modules/roster.py
- gajim/common/preview_helpers.py
- gajim/common/proxy65_manager.py
- gajim/common/settings.py
- gajim/common/styling.py
- gajim/gtk/accounts.py
- gajim/gtk/advanced_config.py
- gajim/gtk/avatar.py
- gajim/gtk/builder.py
- gajim/gtk/conversation/rows/widgets.py
- gajim/gtk/dataform.py
- gajim/gtk/groupchat_affiliation.py
- gajim/gtk/groupchat_info.py
- gajim/gtk/menus.py
- gajim/gtk/profile.py
- gajim/gtk/settings.py
- gajim/gtk/ssl_error_dialog.py
- gajim/gtk/tooltips.py
- gajim/gtk/vcard_grid.py
Changes:
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | from nbxmpp.protocol import JID
|
| 32 | 32 | |
| 33 | 33 | from gajim.common.i18n import _
|
| 34 | -from gajim.common.i18n import Q_
|
|
| 34 | +from gajim.common.i18n import p_
|
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | STOP_EVENT = True
|
| ... | ... | @@ -354,21 +354,21 @@ class CallType(Enum): |
| 354 | 354 | |
| 355 | 355 | |
| 356 | 356 | MUC_CREATION_EXAMPLES = [
|
| 357 | - (Q_('?Group chat name:Team'),
|
|
| 358 | - Q_('?Group chat description:Project discussion'),
|
|
| 359 | - Q_('?Group chat address:team')),
|
|
| 360 | - (Q_('?Group chat name:Family'),
|
|
| 361 | - Q_('?Group chat description:Spring gathering'),
|
|
| 362 | - Q_('?Group chat address:family')),
|
|
| 363 | - (Q_('?Group chat name:Vacation'),
|
|
| 364 | - Q_('?Group chat description:Trip planning'),
|
|
| 365 | - Q_('?Group chat address:vacation')),
|
|
| 366 | - (Q_('?Group chat name:Repairs'),
|
|
| 367 | - Q_('?Group chat description:Local help group'),
|
|
| 368 | - Q_('?Group chat address:repairs')),
|
|
| 369 | - (Q_('?Group chat name:News'),
|
|
| 370 | - Q_('?Group chat description:Local news and reports'),
|
|
| 371 | - Q_('?Group chat address:news')),
|
|
| 357 | + (p_('Group chat name', 'Team'),
|
|
| 358 | + p_('Group chat description', 'Project discussion'),
|
|
| 359 | + p_('Group chat address', 'team')),
|
|
| 360 | + (p_('Group chat name', 'Family'),
|
|
| 361 | + p_('Group chat description', 'Spring gathering'),
|
|
| 362 | + p_('Group chat address', 'family')),
|
|
| 363 | + (p_('Group chat name', 'Vacation'),
|
|
| 364 | + p_('Group chat description', 'Trip planning'),
|
|
| 365 | + p_('Group chat address', 'vacation')),
|
|
| 366 | + (p_('Group chat name', 'Repairs'),
|
|
| 367 | + p_('Group chat description', 'Local help group'),
|
|
| 368 | + p_('Group chat address', 'repairs')),
|
|
| 369 | + (p_('Group chat name', 'News'),
|
|
| 370 | + p_('Group chat description', 'Local news and reports'),
|
|
| 371 | + p_('Group chat address', 'news')),
|
|
| 372 | 372 | ]
|
| 373 | 373 | |
| 374 | 374 | |
| ... | ... | @@ -921,22 +921,22 @@ def is_active(self): |
| 921 | 921 | ]
|
| 922 | 922 | |
| 923 | 923 | SHOW_STRING = {
|
| 924 | - 'dnd': _('Busy'),
|
|
| 925 | - 'xa': _('Not Available'),
|
|
| 926 | - 'chat': _('Free for Chat'),
|
|
| 927 | - 'online': Q_('?user status:Available'),
|
|
| 924 | + 'dnd': p_('User status', 'Busy'),
|
|
| 925 | + 'xa': p_('User status', 'Not Available'),
|
|
| 926 | + 'chat': p_('User status', 'Free for Chat'),
|
|
| 927 | + 'online': p_('User status', 'Available'),
|
|
| 928 | 928 | 'connecting': _('Connecting'),
|
| 929 | - 'away': _('Away'),
|
|
| 929 | + 'away': p_('User status', 'Away'),
|
|
| 930 | 930 | 'offline': _('Offline'),
|
| 931 | 931 | }
|
| 932 | 932 | |
| 933 | 933 | SHOW_STRING_MNEMONIC = {
|
| 934 | - 'dnd': _('_Busy'),
|
|
| 935 | - 'xa': _('_Not Available'),
|
|
| 936 | - 'chat': _('_Free for Chat'),
|
|
| 937 | - 'online': Q_('?user status:_Available'),
|
|
| 934 | + 'dnd': p_('User status', '_Busy'),
|
|
| 935 | + 'xa': p_('User status', '_Not Available'),
|
|
| 936 | + 'chat': p_('User status', '_Free for Chat'),
|
|
| 937 | + 'online': p_('User status', '_Available'),
|
|
| 938 | 938 | 'connecting': _('Connecting'),
|
| 939 | - 'away': _('A_way'),
|
|
| 939 | + 'away': p_('User status', 'A_way'),
|
|
| 940 | 940 | 'offline': _('_Offline'),
|
| 941 | 941 | }
|
| 942 | 942 |
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | import logging
|
| 21 | 21 | import traceback
|
| 22 | 22 | import inspect
|
| 23 | +import operator
|
|
| 23 | 24 | |
| 24 | 25 | from nbxmpp import NodeProcessed
|
| 25 | 26 | |
| ... | ... | @@ -55,23 +56,17 @@ def register_event_handler(self, |
| 55 | 56 | priority: int,
|
| 56 | 57 | handler: HandlerFuncT) -> None:
|
| 57 | 58 | |
| 58 | - if event_name in self.handlers:
|
|
| 59 | - handlers_list = self.handlers[event_name]
|
|
| 60 | - if (priority, handler) in handlers_list:
|
|
| 61 | - # Don’t register same handler/prio multiple times
|
|
| 62 | - return
|
|
| 63 | - |
|
| 64 | - i = 0
|
|
| 65 | - for i, handler_tuple in enumerate(handlers_list):
|
|
| 66 | - if priority < handler_tuple[0]:
|
|
| 67 | - break
|
|
| 68 | - else:
|
|
| 69 | - # no event with smaller prio found, put it at the end
|
|
| 70 | - i += 1
|
|
| 71 | - |
|
| 72 | - handlers_list.insert(i, (priority, handler))
|
|
| 73 | - else:
|
|
| 59 | + if event_name not in self.handlers:
|
|
| 74 | 60 | self.handlers[event_name] = [(priority, handler)]
|
| 61 | + return
|
|
| 62 | + |
|
| 63 | + handlers_list = self.handlers[event_name]
|
|
| 64 | + if (priority, handler) in handlers_list:
|
|
| 65 | + # Don’t register same handler/prio multiple times
|
|
| 66 | + return
|
|
| 67 | + |
|
| 68 | + handlers_list.append((priority, handler))
|
|
| 69 | + handlers_list.sort(key=operator.itemgetter(0))
|
|
| 75 | 70 | |
| 76 | 71 | def remove_event_handler(self,
|
| 77 | 72 | event_name: str,
|
| ... | ... | @@ -88,7 +88,7 @@ |
| 88 | 88 | from gajim.common import app
|
| 89 | 89 | from gajim.common import configpaths
|
| 90 | 90 | from gajim.common import iana
|
| 91 | -from gajim.common.i18n import Q_
|
|
| 91 | +from gajim.common.i18n import p_
|
|
| 92 | 92 | from gajim.common.i18n import _
|
| 93 | 93 | from gajim.common.i18n import ngettext
|
| 94 | 94 | from gajim.common.i18n import get_rfc5646_lang
|
| ... | ... | @@ -183,24 +183,24 @@ def get_uf_show(show: str, use_mnemonic: bool = False) -> str: |
| 183 | 183 | |
| 184 | 184 | def get_uf_sub(sub: str) -> str:
|
| 185 | 185 | if sub == 'none':
|
| 186 | - uf_sub = Q_('?Subscription we already have:None')
|
|
| 186 | + uf_sub = p_('Contact subscription', 'None')
|
|
| 187 | 187 | elif sub == 'to':
|
| 188 | - uf_sub = _('To')
|
|
| 188 | + uf_sub = p_('Contact subscription', 'To')
|
|
| 189 | 189 | elif sub == 'from':
|
| 190 | - uf_sub = _('From')
|
|
| 190 | + uf_sub = p_('Contact subscription', 'From')
|
|
| 191 | 191 | elif sub == 'both':
|
| 192 | - uf_sub = _('Both')
|
|
| 192 | + uf_sub = p_('Contact subscription', 'Both')
|
|
| 193 | 193 | else:
|
| 194 | - uf_sub = _('Unknown')
|
|
| 194 | + uf_sub = p_('Contact subscription', 'Unknown')
|
|
| 195 | 195 | |
| 196 | 196 | return uf_sub
|
| 197 | 197 | |
| 198 | 198 | |
| 199 | 199 | def get_uf_ask(ask: Union[str, None]) -> str:
|
| 200 | 200 | if ask is None:
|
| 201 | - uf_ask = Q_('?Ask (for Subscription):None')
|
|
| 201 | + uf_ask = p_('Contact subscription', 'None')
|
|
| 202 | 202 | elif ask == 'subscribe':
|
| 203 | - uf_ask = _('Subscribe')
|
|
| 203 | + uf_ask = p_('Contact subscription', 'Subscribe')
|
|
| 204 | 204 | else:
|
| 205 | 205 | uf_ask = ask
|
| 206 | 206 | |
| ... | ... | @@ -213,19 +213,19 @@ def get_uf_role(role: Union[Role, str], plural: bool = False) -> str: |
| 213 | 213 | role = role.value
|
| 214 | 214 | |
| 215 | 215 | if role == 'none':
|
| 216 | - return Q_('?Group Chat Contact Role:None')
|
|
| 216 | + return p_('Group chat contact role', 'None')
|
|
| 217 | 217 | if role == 'moderator':
|
| 218 | 218 | if plural:
|
| 219 | - return _('Moderators')
|
|
| 220 | - return _('Moderator')
|
|
| 219 | + return p_('Group chat contact role', 'Moderators')
|
|
| 220 | + return p_('Group chat contact role', 'Moderator')
|
|
| 221 | 221 | if role == 'participant':
|
| 222 | 222 | if plural:
|
| 223 | - return _('Participants')
|
|
| 224 | - return _('Participant')
|
|
| 223 | + return p_('Group chat contact role', 'Participants')
|
|
| 224 | + return p_('Group chat contact role', 'Participant')
|
|
| 225 | 225 | if role == 'visitor':
|
| 226 | 226 | if plural:
|
| 227 | - return _('Visitors')
|
|
| 228 | - return _('Visitor')
|
|
| 227 | + return p_('Group chat contact role', 'Visitors')
|
|
| 228 | + return p_('Group chat contact role', 'Visitor')
|
|
| 229 | 229 | return ''
|
| 230 | 230 | |
| 231 | 231 | |
| ... | ... | @@ -237,19 +237,19 @@ def get_uf_affiliation(affiliation: Union[Affiliation, str], |
| 237 | 237 | affiliation = affiliation.value
|
| 238 | 238 | |
| 239 | 239 | if affiliation == 'none':
|
| 240 | - return Q_('?Group Chat Contact Affiliation:None')
|
|
| 240 | + return p_('Group chat contact affiliation', 'None')
|
|
| 241 | 241 | if affiliation == 'owner':
|
| 242 | 242 | if plural:
|
| 243 | - return _('Owners')
|
|
| 244 | - return _('Owner')
|
|
| 243 | + return p_('Group chat contact affiliation', 'Owners')
|
|
| 244 | + return p_('Group chat contact affiliation', 'Owner')
|
|
| 245 | 245 | if affiliation == 'admin':
|
| 246 | 246 | if plural:
|
| 247 | - return _('Administrators')
|
|
| 248 | - return _('Administrator')
|
|
| 247 | + return p_('Group chat contact affiliation', 'Administrators')
|
|
| 248 | + return p_('Group chat contact affiliation', 'Administrator')
|
|
| 249 | 249 | if affiliation == 'member':
|
| 250 | 250 | if plural:
|
| 251 | - return _('Members')
|
|
| 252 | - return _('Member')
|
|
| 251 | + return p_('Group chat contact affiliation', 'Members')
|
|
| 252 | + return p_('Group chat contact affiliation', 'Member')
|
|
| 253 | 253 | return ''
|
| 254 | 254 | |
| 255 | 255 |
| ... | ... | @@ -122,28 +122,7 @@ def is_rtl_text(text: str) -> bool: |
| 122 | 122 | return False
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | -def Q_(text: str) -> str:
|
|
| 126 | - '''
|
|
| 127 | - Translate the given text, optionally qualified with a special
|
|
| 128 | - construction, which will help translators to disambiguate between
|
|
| 129 | - same terms, but in different contexts.
|
|
| 130 | - |
|
| 131 | - When translated text is returned - this rudimentary construction
|
|
| 132 | - will be stripped off, if it's present.
|
|
| 133 | - |
|
| 134 | - Here is the construction to use:
|
|
| 135 | - Q_("?vcard:Unknown")
|
|
| 136 | - |
|
| 137 | - Everything between ? and : - is the qualifier to convey the context
|
|
| 138 | - to the translators. Everything after : - is the text itself.
|
|
| 139 | - '''
|
|
| 140 | - text = _(text)
|
|
| 141 | - if text.startswith('?'):
|
|
| 142 | - text = text.split(':', 1)[1]
|
|
| 143 | - return text
|
|
| 144 | - |
|
| 145 | - |
|
| 146 | -def P_(context: str, message: str) -> str:
|
|
| 125 | +def p_(context: str, message: str) -> str:
|
|
| 147 | 126 | return _translation.pgettext(context, message)
|
| 148 | 127 | |
| 149 | 128 |
| ... | ... | @@ -342,7 +342,7 @@ def _get_query_id(self, jid: str) -> str: |
| 342 | 342 | self._mam_query_ids[jid] = query_id
|
| 343 | 343 | return query_id
|
| 344 | 344 | |
| 345 | - def _get_query_params(self) -> tuple[Optional[ſtr], Optional[datetime]]:
|
|
| 345 | + def _get_query_params(self) -> tuple[Optional[str], Optional[datetime]]:
|
|
| 346 | 346 | own_jid = self._con.get_own_jid().bare
|
| 347 | 347 | archive = app.storage.archive.get_archive_infos(own_jid)
|
| 348 | 348 |
| ... | ... | @@ -61,8 +61,7 @@ def __init__(self, con: types.Client) -> None: |
| 61 | 61 | ]
|
| 62 | 62 | |
| 63 | 63 | # XEPs for which this message module should not be executed
|
| 64 | - self._message_namespaces = set([Namespace.ROSTERX,
|
|
| 65 | - Namespace.IBB])
|
|
| 64 | + self._message_namespaces = {Namespace.ROSTERX, Namespace.IBB}
|
|
| 66 | 65 | |
| 67 | 66 | def _check_if_unknown_contact(self,
|
| 68 | 67 | _con: types.xmppClient,
|
| ... | ... | @@ -185,13 +185,13 @@ def _get_items_with_group(self, group: str) -> list[RosterItem]: |
| 185 | 185 | def remove_group(self, group: str) -> None:
|
| 186 | 186 | items = self._get_items_with_group(group)
|
| 187 | 187 | for item in items:
|
| 188 | - new_groups = item.groups - set([group])
|
|
| 188 | + new_groups = item.groups - {group}
|
|
| 189 | 189 | self.set_groups(item.jid, new_groups)
|
| 190 | 190 | |
| 191 | 191 | def rename_group(self, group: str, new_group: str) -> None:
|
| 192 | 192 | items = self._get_items_with_group(group)
|
| 193 | 193 | for item in items:
|
| 194 | - new_groups = item.groups - set([group])
|
|
| 194 | + new_groups = item.groups - {group}
|
|
| 195 | 195 | new_groups.add(new_group)
|
| 196 | 196 | self.set_groups(item.jid, new_groups)
|
| 197 | 197 |
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | |
| 43 | 43 | from gajim.common.helpers import sanitize_filename
|
| 44 | 44 | from gajim.common.i18n import _
|
| 45 | -from gajim.common.i18n import P_
|
|
| 45 | +from gajim.common.i18n import p_
|
|
| 46 | 46 | |
| 47 | 47 | log = logging.getLogger('gajim.c.preview_helpers')
|
| 48 | 48 | |
| ... | ... | @@ -388,13 +388,13 @@ def fmt(f: float) -> str: |
| 388 | 388 | degrees = i
|
| 389 | 389 | return '%d°%02d′%02d′′' % (degrees, minutes, seconds)
|
| 390 | 390 | if lat >= 0:
|
| 391 | - slat = P_('positive latitude', '%sN') % fmt(lat)
|
|
| 391 | + slat = p_('positive latitude', '%sN') % fmt(lat)
|
|
| 392 | 392 | else:
|
| 393 | - slat = P_('negative latitude', '%sS') % fmt(-lat)
|
|
| 393 | + slat = p_('negative latitude', '%sS') % fmt(-lat)
|
|
| 394 | 394 | if lon >= 0:
|
| 395 | - slon = P_('positive longitude', '%sE') % fmt(lon)
|
|
| 395 | + slon = p_('positive longitude', '%sE') % fmt(lon)
|
|
| 396 | 396 | else:
|
| 397 | - slon = P_('negative longitude', '%sW') % fmt(-lon)
|
|
| 397 | + slon = p_('negative longitude', '%sW') % fmt(-lon)
|
|
| 398 | 398 | return '%s %s' % (slat, slon)
|
| 399 | 399 | |
| 400 | 400 |
| ... | ... | @@ -341,7 +341,7 @@ def pollin(self): |
| 341 | 341 | self.disconnect()
|
| 342 | 342 | self.state += 1
|
| 343 | 343 | else:
|
| 344 | - assert False, 'unexpected state: %d' % self.state
|
|
| 344 | + raise AssertionError('unexpected state: %d' % self.state)
|
|
| 345 | 345 | |
| 346 | 346 | def do_connect(self):
|
| 347 | 347 | try:
|
| ... | ... | @@ -478,7 +478,7 @@ def pollin(self): |
| 478 | 478 | self.disconnect()
|
| 479 | 479 | self.state += 1
|
| 480 | 480 | else:
|
| 481 | - assert False, 'unexpected state: %d' % self.state
|
|
| 481 | + raise AssertionError('unexpected state: %d' % self.state)
|
|
| 482 | 482 | |
| 483 | 483 | def do_connect(self):
|
| 484 | 484 | try:
|
| ... | ... | @@ -414,12 +414,12 @@ def _migrate_app_settings(self) -> None: |
| 414 | 414 | # Migrate deprecated settings
|
| 415 | 415 | value = app_settings.pop('send_chatstate_muc_default', None)
|
| 416 | 416 | if value is not None:
|
| 417 | - for account, settings in self._account_settings.items():
|
|
| 417 | + for _account, settings in self._account_settings.items():
|
|
| 418 | 418 | settings['account']['gc_send_chatstate_default'] = value
|
| 419 | 419 | |
| 420 | 420 | value = app_settings.pop('send_chatstate_default', None)
|
| 421 | 421 | if value is not None:
|
| 422 | - for account, settings in self._account_settings.items():
|
|
| 422 | + for _account, settings in self._account_settings.items():
|
|
| 423 | 423 | settings['account']['send_chatstate_default'] = value
|
| 424 | 424 | |
| 425 | 425 | value = app_settings.pop('print_join_left_default', None)
|
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | EMPH = '_'
|
| 38 | 38 | |
| 39 | 39 | WHITESPACE = set(string.whitespace)
|
| 40 | -SPAN_DIRS = set([PRE, STRONG, STRIKE, EMPH])
|
|
| 40 | +SPAN_DIRS = {PRE, STRONG, STRIKE, EMPH}
|
|
| 41 | 41 | VALID_SPAN_START = WHITESPACE | SPAN_DIRS
|
| 42 | 42 | |
| 43 | 43 | PRE_RX = r'(?P<pre>^```.+?(^```$(.|\Z)))'
|
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | from gajim.common import passwords
|
| 32 | 32 | from gajim.common.const import ClientState
|
| 33 | 33 | from gajim.common.i18n import _
|
| 34 | -from gajim.common.i18n import Q_
|
|
| 34 | +from gajim.common.i18n import p_
|
|
| 35 | 35 | from gajim.common.settings import AllSettingsT
|
| 36 | 36 | from gajim.common import types
|
| 37 | 37 | |
| ... | ... | @@ -522,7 +522,7 @@ def __init__(self, account: str) -> None: |
| 522 | 522 | self._switch_state_label = Gtk.Label()
|
| 523 | 523 | self._switch_state_label.set_xalign(0)
|
| 524 | 524 | self._switch_state_label.set_valign(Gtk.Align.CENTER)
|
| 525 | - label_width = max(len(Q_('?switch:On')), len(Q_('?switch:Off')))
|
|
| 525 | + label_width = max(len(p_('Switch', 'On')), len(p_('Switch', 'Off')))
|
|
| 526 | 526 | self._switch_state_label.set_width_chars(label_width)
|
| 527 | 527 | self._set_label(account_enabled)
|
| 528 | 528 | |
| ... | ... | @@ -552,7 +552,7 @@ def enable_account(self, state: bool) -> None: |
| 552 | 552 | self._set_label(state)
|
| 553 | 553 | |
| 554 | 554 | def _set_label(self, active: bool) -> None:
|
| 555 | - text = Q_('?switch:On') if active else Q_('?switch:Off')
|
|
| 555 | + text = p_('Switch', 'On') if active else p_('Switch', 'Off')
|
|
| 556 | 556 | self._switch_state_label.set_text(text)
|
| 557 | 557 | |
| 558 | 558 | def _on_enable_switch(self,
|
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | from gajim.common import app
|
| 32 | 32 | from gajim.common.i18n import _
|
| 33 | -from gajim.common.i18n import Q_
|
|
| 33 | +from gajim.common.i18n import p_
|
|
| 34 | 34 | |
| 35 | 35 | from gajim.common.setting_values import ADVANCED_SETTINGS
|
| 36 | 36 | from gajim.common.setting_values import APP_SETTINGS
|
| ... | ... | @@ -53,9 +53,9 @@ class Column(IntEnum): |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | SETTING_TYPES = {
|
| 56 | - bool: Q_('?config type:Boolean'),
|
|
| 57 | - int: Q_('?config type:Integer'),
|
|
| 58 | - str: Q_('?config type:Text'),
|
|
| 56 | + bool: p_('Configuration type', 'Boolean'),
|
|
| 57 | + int: p_('Configuration type', 'Integer'),
|
|
| 58 | + str: p_('Configuration type', 'Text'),
|
|
| 59 | 59 | }
|
| 60 | 60 | |
| 61 | 61 | |
| ... | ... | @@ -81,7 +81,7 @@ def __init__(self) -> None: |
| 81 | 81 | |
| 82 | 82 | renderer_text = Gtk.CellRendererText()
|
| 83 | 83 | renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
|
| 84 | - col = Gtk.TreeViewColumn(Q_('?config:Preference Name'),
|
|
| 84 | + col = Gtk.TreeViewColumn(p_('Configuration', 'Preference Name'),
|
|
| 85 | 85 | renderer_text, text=0)
|
| 86 | 86 | treeview.insert_column(col, -1)
|
| 87 | 87 | col.set_cell_data_func(renderer_text,
|
| ... | ... | @@ -94,7 +94,7 @@ def __init__(self) -> None: |
| 94 | 94 | self.renderer_text.connect('edited', self._on_config_edited)
|
| 95 | 95 | self.renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
|
| 96 | 96 | col = Gtk.TreeViewColumn(
|
| 97 | - Q_('?config:Value'), self.renderer_text, text=1)
|
|
| 97 | + p_('Configuration', 'Value'), self.renderer_text, text=1)
|
|
| 98 | 98 | treeview.insert_column(col, -1)
|
| 99 | 99 | col.set_cell_data_func(self.renderer_text,
|
| 100 | 100 | self._value_column_data_callback)
|
| ... | ... | @@ -103,7 +103,8 @@ def __init__(self) -> None: |
| 103 | 103 | col.set_resizable(True)
|
| 104 | 104 | |
| 105 | 105 | renderer_text = Gtk.CellRendererText()
|
| 106 | - col = Gtk.TreeViewColumn(Q_('?config:Type'), renderer_text, text=2)
|
|
| 106 | + col = Gtk.TreeViewColumn(
|
|
| 107 | + p_('Configuration', 'Type'), renderer_text, text=2)
|
|
| 107 | 108 | treeview.insert_column(col, -1)
|
| 108 | 109 | col.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
|
| 109 | 110 | |
| ... | ... | @@ -159,7 +160,8 @@ def _on_treeview_selection_changed(self, |
| 159 | 160 | setting = model[iter_][Column.NAME]
|
| 160 | 161 | desc = ADVANCED_SETTINGS['app'][setting]
|
| 161 | 162 | |
| 162 | - self._ui.description.set_text(desc or Q_('?config description:None'))
|
|
| 163 | + self._ui.description.set_text(
|
|
| 164 | + desc or p_('Configuration description', 'None'))
|
|
| 163 | 165 | self._ui.reset_button.set_sensitive(not model[iter_][Column.IS_DEFAULT])
|
| 164 | 166 | |
| 165 | 167 | def _on_treeview_row_activated(self,
|
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | import logging
|
| 21 | 21 | import hashlib
|
| 22 | 22 | from math import pi
|
| 23 | -from functools import lru_cache
|
|
| 23 | +import functools
|
|
| 24 | 24 | from collections import defaultdict
|
| 25 | 25 | from pathlib import Path
|
| 26 | 26 | |
| ... | ... | @@ -109,7 +109,7 @@ def generate_avatar(letters: str, |
| 109 | 109 | return context.get_target()
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | -@lru_cache(maxsize=None)
|
|
| 112 | +@functools.cache
|
|
| 113 | 113 | def generate_default_avatar(letter: str,
|
| 114 | 114 | color: tuple[float, float, float],
|
| 115 | 115 | size: int,
|
| ... | ... | @@ -122,7 +122,7 @@ def generate_default_avatar(letter: str, |
| 122 | 122 | return surface
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | -@lru_cache(maxsize=None)
|
|
| 125 | +@functools.cache
|
|
| 126 | 126 | def make_workspace_avatar(letter: str,
|
| 127 | 127 | color: tuple[float, float, float],
|
| 128 | 128 | size: int,
|
| ... | ... | @@ -186,7 +186,7 @@ def add_status_to_avatar(surface: cairo.ImageSurface, |
| 186 | 186 | return context.get_target()
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | -@lru_cache(maxsize=128)
|
|
| 189 | +@functools.lru_cache(maxsize=128)
|
|
| 190 | 190 | def get_show_circle(show: Union[str, types.PresenceShowT],
|
| 191 | 191 | size: int,
|
| 192 | 192 | scale: int
|
| ... | ... | @@ -57,7 +57,7 @@ def __init__(self, |
| 57 | 57 | self._builder.add_from_string(xml_text)
|
| 58 | 58 | |
| 59 | 59 | @staticmethod
|
| 60 | - @functools.lru_cache(maxsize=None)
|
|
| 60 | + @functools.cache
|
|
| 61 | 61 | def _load_string_from_filename(filename: str, gettext_: Any) -> str:
|
| 62 | 62 | file_path = str(configpaths.get('GUI') / filename)
|
| 63 | 63 |
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | |
| 28 | 28 | from gajim.common import app
|
| 29 | 29 | from gajim.common.const import AvatarSize
|
| 30 | -from gajim.common.i18n import Q_
|
|
| 30 | +from gajim.common.i18n import p_
|
|
| 31 | 31 | from gajim.common.modules.contacts import GroupchatContact
|
| 32 | 32 | from gajim.common.types import ChatContactT
|
| 33 | 33 | |
| ... | ... | @@ -155,7 +155,7 @@ def set_receipt_icon_visible(self, visible: bool) -> None: |
| 155 | 155 | self._marker_image.set_visible(visible)
|
| 156 | 156 | self._marker_image.set_from_icon_name(
|
| 157 | 157 | 'feather-check-symbolic', Gtk.IconSize.MENU)
|
| 158 | - self._marker_image.set_tooltip_text(Q_('?Message state:Received'))
|
|
| 158 | + self._marker_image.set_tooltip_text(p_('Message state', 'Received'))
|
|
| 159 | 159 | |
| 160 | 160 | def set_correction_icon_visible(self, visible: bool) -> None:
|
| 161 | 161 | self._correction_image.set_visible(visible)
|
| ... | ... | @@ -187,7 +187,7 @@ def _analyse_fields(form_node: Union[SimpleDataForm, MultipleDataForm], |
| 187 | 187 | # Don’t overwrite option
|
| 188 | 188 | return
|
| 189 | 189 | |
| 190 | - label_lengths = set([0])
|
|
| 190 | + label_lengths = {0}
|
|
| 191 | 191 | for field in form_node.iter_fields():
|
| 192 | 192 | if field.type_ == 'hidden':
|
| 193 | 193 | continue
|
| ... | ... | @@ -213,7 +213,7 @@ def _set_remove_button_state(self, |
| 213 | 213 | self._ui.remove_button.set_sensitive(True)
|
| 214 | 214 | return
|
| 215 | 215 | |
| 216 | - if set(['owner', 'admin']).intersection(selected_affiliations):
|
|
| 216 | + if {'owner', 'admin'}.intersection(selected_affiliations):
|
|
| 217 | 217 | self._ui.remove_button.set_sensitive(False)
|
| 218 | 218 | self._ui.remove_button.set_tooltip_text(
|
| 219 | 219 | _('You are not allowed to modify the affiliation '
|
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | |
| 28 | 28 | from gajim.common import app
|
| 29 | 29 | from gajim.common.i18n import _
|
| 30 | -from gajim.common.i18n import Q_
|
|
| 30 | +from gajim.common.i18n import p_
|
|
| 31 | 31 | from gajim.common.helpers import open_uri
|
| 32 | 32 | from gajim.common.helpers import get_groupchat_name
|
| 33 | 33 | from gajim.common.const import RFC5646_LANGUAGE_TAGS
|
| ... | ... | @@ -40,63 +40,63 @@ |
| 40 | 40 | MUC_FEATURES = {
|
| 41 | 41 | 'muc_open': (
|
| 42 | 42 | 'feather-globe-symbolic',
|
| 43 | - Q_('?Group chat feature:Open'),
|
|
| 43 | + p_('Group chat feature', 'Open'),
|
|
| 44 | 44 | _('Anyone can join this group chat')),
|
| 45 | 45 | 'muc_membersonly': (
|
| 46 | 46 | 'feather-user-check-symbolic',
|
| 47 | - Q_('?Group chat feature:Members Only'),
|
|
| 47 | + p_('Group chat feature', 'Members Only'),
|
|
| 48 | 48 | _('This group chat is restricted '
|
| 49 | 49 | 'to members only')),
|
| 50 | 50 | 'muc_nonanonymous': (
|
| 51 | 51 | 'feather-shield-off-symbolic',
|
| 52 | - Q_('?Group chat feature:Not Anonymous'),
|
|
| 52 | + p_('Group chat feature', 'Not Anonymous'),
|
|
| 53 | 53 | _('All other group chat participants '
|
| 54 | 54 | 'can see your XMPP address')),
|
| 55 | 55 | 'muc_semianonymous': (
|
| 56 | 56 | 'feather-shield-symbolic',
|
| 57 | - Q_('?Group chat feature:Semi-Anonymous'),
|
|
| 57 | + p_('Group chat feature', 'Semi-Anonymous'),
|
|
| 58 | 58 | _('Only moderators can see your XMPP address')),
|
| 59 | 59 | 'muc_moderated': (
|
| 60 | 60 | 'feather-mic-off-symbolic',
|
| 61 | - Q_('?Group chat feature:Moderated'),
|
|
| 61 | + p_('Group chat feature', 'Moderated'),
|
|
| 62 | 62 | _('Participants entering this group chat need '
|
| 63 | 63 | 'to request permission to send messages')),
|
| 64 | 64 | 'muc_unmoderated': (
|
| 65 | 65 | 'feather-mic-symbolic',
|
| 66 | - Q_('?Group chat feature:Not Moderated'),
|
|
| 66 | + p_('Group chat feature', 'Not Moderated'),
|
|
| 67 | 67 | _('Participants entering this group chat are '
|
| 68 | 68 | 'allowed to send messages')),
|
| 69 | 69 | 'muc_public': (
|
| 70 | 70 | 'feather-eye-symbolic',
|
| 71 | - Q_('?Group chat feature:Public'),
|
|
| 71 | + p_('Group chat feature', 'Public'),
|
|
| 72 | 72 | _('Group chat can be found via search')),
|
| 73 | 73 | 'muc_hidden': (
|
| 74 | 74 | 'feather-eye-off-symbolic',
|
| 75 | - Q_('?Group chat feature:Hidden'),
|
|
| 75 | + p_('Group chat feature', 'Hidden'),
|
|
| 76 | 76 | _('This group chat can not be found via search')),
|
| 77 | 77 | 'muc_passwordprotected': (
|
| 78 | 78 | 'feather-lock-symbolic',
|
| 79 | - Q_('?Group chat feature:Password Required'),
|
|
| 79 | + p_('Group chat feature', 'Password Required'),
|
|
| 80 | 80 | _('This group chat '
|
| 81 | 81 | 'does require a password upon entry')),
|
| 82 | 82 | 'muc_unsecured': (
|
| 83 | 83 | 'feather-unlock-symbolic',
|
| 84 | - Q_('?Group chat feature:No Password Required'),
|
|
| 84 | + p_('Group chat feature', 'No Password Required'),
|
|
| 85 | 85 | _('This group chat does not require '
|
| 86 | 86 | 'a password upon entry')),
|
| 87 | 87 | 'muc_persistent': (
|
| 88 | 88 | 'feather-hard-drive-symbolic',
|
| 89 | - Q_('?Group chat feature:Persistent'),
|
|
| 89 | + p_('Group chat feature', 'Persistent'),
|
|
| 90 | 90 | _('This group chat persists '
|
| 91 | 91 | 'even if there are no participants')),
|
| 92 | 92 | 'muc_temporary': (
|
| 93 | 93 | 'feather-clock-symbolic',
|
| 94 | - Q_('?Group chat feature:Temporary'),
|
|
| 94 | + p_('Group chat feature', 'Temporary'),
|
|
| 95 | 95 | _('This group chat will be destroyed '
|
| 96 | 96 | 'once the last participant left')),
|
| 97 | 97 | 'mam': (
|
| 98 | 98 | 'feather-server-symbolic',
|
| 99 | - Q_('?Group chat feature:Archiving'),
|
|
| 99 | + p_('Group chat feature', 'Archiving'),
|
|
| 100 | 100 | _('Messages are archived on the server')),
|
| 101 | 101 | }
|
| 102 | 102 |
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | from gajim.common.helpers import is_role_change_allowed
|
| 40 | 40 | from gajim.common.helpers import jid_is_blocked
|
| 41 | 41 | from gajim.common.i18n import _
|
| 42 | -from gajim.common.i18n import Q_
|
|
| 42 | +from gajim.common.i18n import p_
|
|
| 43 | 43 | from gajim.common.i18n import get_short_lang_code
|
| 44 | 44 | from gajim.common.const import URIType
|
| 45 | 45 | from gajim.common.const import XmppUriQuery
|
| ... | ... | @@ -617,10 +617,12 @@ def get_chat_row_menu(contact: types.ChatContactT, |
| 617 | 617 | timestamp_formatted = timestamp.strftime(time_format)
|
| 618 | 618 | copy_text = f'{timestamp_formatted} - {name}: {text}'
|
| 619 | 619 | menu_items.append(
|
| 620 | - (Q_('?Message row action:Copy'), 'win.copy-message', f'"{copy_text}"'))
|
|
| 620 | + (p_('Message row action', 'Copy'),
|
|
| 621 | + 'win.copy-message',
|
|
| 622 | + f'"{copy_text}"'))
|
|
| 621 | 623 | |
| 622 | 624 | menu_items.append(
|
| 623 | - (Q_('?Message row action:Select Messages…'),
|
|
| 625 | + (p_('Message row action', 'Select Messages…'),
|
|
| 624 | 626 | 'win.activate-message-selection',
|
| 625 | 627 | GLib.Variant('u', log_line_id or 0)))
|
| 626 | 628 | |
| ... | ... | @@ -634,7 +636,7 @@ def get_chat_row_menu(contact: types.ChatContactT, |
| 634 | 636 | show_quote = False
|
| 635 | 637 | if show_quote:
|
| 636 | 638 | menu_items.append((
|
| 637 | - Q_('?Message row action:Quote…'),
|
|
| 639 | + p_('Message row action', 'Quote…'),
|
|
| 638 | 640 | 'win.quote',
|
| 639 | 641 | f'"{text}"'))
|
| 640 | 642 | |
| ... | ... | @@ -644,7 +646,7 @@ def get_chat_row_menu(contact: types.ChatContactT, |
| 644 | 646 | contact, message_id)
|
| 645 | 647 | if show_correction:
|
| 646 | 648 | menu_items.append((
|
| 647 | - Q_('?Message row action:Correct…'), 'win.correct-message', None))
|
|
| 649 | + p_('Message row action', 'Correct…'), 'win.correct-message', None))
|
|
| 648 | 650 | |
| 649 | 651 | show_retract = False
|
| 650 | 652 | if isinstance(contact, GroupchatContact) and contact.is_joined:
|
| ... | ... | @@ -665,7 +667,9 @@ def get_chat_row_menu(contact: types.ChatContactT, |
| 665 | 667 | jid=contact.jid,
|
| 666 | 668 | stanza_id=stanza_id)
|
| 667 | 669 | menu_items.append((
|
| 668 | - Q_('?Message row action:Retract…'), 'win.retract-message', param))
|
|
| 670 | + p_('Message row action', 'Retract…'),
|
|
| 671 | + 'win.retract-message',
|
|
| 672 | + param))
|
|
| 669 | 673 | |
| 670 | 674 | menu = GajimMenu.from_list(menu_items)
|
| 671 | 675 | return menu
|
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | from gajim.common import app
|
| 37 | 37 | from gajim.common.const import AvatarSize
|
| 38 | 38 | from gajim.common.i18n import _
|
| 39 | -from gajim.common.i18n import Q_
|
|
| 39 | +from gajim.common.i18n import p_
|
|
| 40 | 40 | |
| 41 | 41 | from gajim.gui.avatar import clip_circle
|
| 42 | 42 | from gajim.gui.avatar_selector import AvatarSelector
|
| ... | ... | @@ -49,19 +49,19 @@ |
| 49 | 49 | log = logging.getLogger('gajim.gui.profile')
|
| 50 | 50 | |
| 51 | 51 | MENU_DICT = {
|
| 52 | - 'fn': Q_('?profile:Full Name'),
|
|
| 52 | + 'fn': p_('Profile', 'Full Name'),
|
|
| 53 | 53 | 'bday': _('Birthday'),
|
| 54 | - 'gender': Q_('?profile:Gender'),
|
|
| 55 | - 'adr': Q_('?profile:Address'),
|
|
| 54 | + 'gender': p_('Profile', 'Gender'),
|
|
| 55 | + 'adr': p_('Profile', 'Address'),
|
|
| 56 | 56 | 'email': _('Email'),
|
| 57 | - 'impp': Q_('?profile:IM Address'),
|
|
| 57 | + 'impp': p_('Profile', 'IM Address'),
|
|
| 58 | 58 | 'tel': _('Phone No.'),
|
| 59 | - 'org': Q_('?profile:Organisation'),
|
|
| 60 | - 'title': Q_('?profile:Title'),
|
|
| 61 | - 'role': Q_('?profile:Role'),
|
|
| 59 | + 'org': p_('Profile', 'Organisation'),
|
|
| 60 | + 'title': p_('Profile', 'Title'),
|
|
| 61 | + 'role': p_('Profile', 'Role'),
|
|
| 62 | 62 | 'url': _('URL'),
|
| 63 | - 'key': Q_('?profile:Public Encryption Key'),
|
|
| 64 | - 'note': Q_('?profile:Note'),
|
|
| 63 | + 'key': p_('Profile', 'Public Encryption Key'),
|
|
| 64 | + 'note': p_('Profile', 'Note'),
|
|
| 65 | 65 | }
|
| 66 | 66 | |
| 67 | 67 |
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | from gajim.common import app
|
| 35 | 35 | from gajim.common import passwords
|
| 36 | 36 | from gajim.common.i18n import _
|
| 37 | -from gajim.common.i18n import Q_
|
|
| 37 | +from gajim.common.i18n import p_
|
|
| 38 | 38 | from gajim.common.setting_values import AllSettingsT
|
| 39 | 39 | |
| 40 | 40 | from .util import get_image_button
|
| ... | ... | @@ -450,7 +450,7 @@ def on_switch(self, switch: Gtk.Switch, *args: Any) -> None: |
| 450 | 450 | self._set_label(value)
|
| 451 | 451 | |
| 452 | 452 | def _set_label(self, active: bool) -> None:
|
| 453 | - text = Q_('?switch:On') if active else Q_('?switch:Off')
|
|
| 453 | + text = p_('Switch', 'On') if active else p_('Switch', 'Off')
|
|
| 454 | 454 | self._switch_state_label.set_text(text)
|
| 455 | 455 | |
| 456 | 456 | |
| ... | ... | @@ -871,7 +871,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: |
| 871 | 871 | def get_setting_value(self) -> str:
|
| 872 | 872 | custom = app.settings.get_account_setting(self.account,
|
| 873 | 873 | 'use_custom_host')
|
| 874 | - return Q_('?switch:On') if custom else Q_('?switch:Off')
|
|
| 874 | + return p_('Switch', 'On') if custom else p_('Switch', 'Off')
|
|
| 875 | 875 | |
| 876 | 876 | |
| 877 | 877 | class ChangePasswordSetting(DialogSetting):
|
| ... | ... | @@ -897,7 +897,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: |
| 897 | 897 | |
| 898 | 898 | def get_setting_value(self) -> str:
|
| 899 | 899 | value = app.settings.get('autoaway')
|
| 900 | - return Q_('?switch:On') if value else Q_('?switch:Off')
|
|
| 900 | + return p_('Switch', 'On') if value else p_('Switch', 'Off')
|
|
| 901 | 901 | |
| 902 | 902 | |
| 903 | 903 | class CutstomAutoExtendedAwaySetting(DialogSetting):
|
| ... | ... | @@ -906,7 +906,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: |
| 906 | 906 | |
| 907 | 907 | def get_setting_value(self) -> str:
|
| 908 | 908 | value = app.settings.get('autoxa')
|
| 909 | - return Q_('?switch:On') if value else Q_('?switch:Off')
|
|
| 909 | + return p_('Switch', 'On') if value else p_('Switch', 'Off')
|
|
| 910 | 910 | |
| 911 | 911 | |
| 912 | 912 | class CustomStunServerSetting(DialogSetting):
|
| ... | ... | @@ -915,7 +915,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: |
| 915 | 915 | |
| 916 | 916 | def get_setting_value(self) -> str:
|
| 917 | 917 | value = app.settings.get('use_stun_server')
|
| 918 | - return Q_('?switch:On') if value else Q_('?switch:Off')
|
|
| 918 | + return p_('Switch', 'On') if value else p_('Switch', 'Off')
|
|
| 919 | 919 | |
| 920 | 920 | |
| 921 | 921 | class NotificationsSetting(DialogSetting):
|
| ... | ... | @@ -924,4 +924,4 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: |
| 924 | 924 | |
| 925 | 925 | def get_setting_value(self) -> str:
|
| 926 | 926 | value = app.settings.get('show_notifications')
|
| 927 | - return Q_('?switch:On') if value else Q_('?switch:Off') |
|
| 927 | + return p_('Switch', 'On') if value else p_('Switch', 'Off') |
| ... | ... | @@ -91,7 +91,7 @@ def _on_connect_clicked(self, _button: Gtk.Button) -> None: |
| 91 | 91 | |
| 92 | 92 | ignored_tls_errors = None
|
| 93 | 93 | if self._error == Gio.TlsCertificateFlags.EXPIRED:
|
| 94 | - ignored_tls_errors = set([Gio.TlsCertificateFlags.EXPIRED])
|
|
| 94 | + ignored_tls_errors = {Gio.TlsCertificateFlags.EXPIRED}
|
|
| 95 | 95 | |
| 96 | 96 | self.destroy()
|
| 97 | 97 | self._client.connect(ignored_tls_errors=ignored_tls_errors) |
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | from gajim.common import types
|
| 43 | 43 | from gajim.common import helpers
|
| 44 | 44 | from gajim.common.const import AvatarSize
|
| 45 | -from gajim.common.i18n import Q_
|
|
| 45 | +from gajim.common.i18n import p_
|
|
| 46 | 46 | from gajim.common.i18n import _
|
| 47 | 47 | from gajim.common.file_props import FileProp
|
| 48 | 48 | |
| ... | ... | @@ -316,26 +316,26 @@ def _create_tooltip(self, file_prop: FileProp, _sid: str) -> Gtk.Grid: |
| 316 | 316 | assert file_prop.tt_account is not None
|
| 317 | 317 | client = app.get_client(file_prop.tt_account)
|
| 318 | 318 | if file_prop.type_ == 'r':
|
| 319 | - type_ = Q_('?Noun:Download')
|
|
| 319 | + type_ = p_('Noun', 'Download')
|
|
| 320 | 320 | actor = _('Sender: ')
|
| 321 | 321 | sender = JID.from_string(file_prop.sender)
|
| 322 | 322 | name = client.get_module('Contacts').get_contact(sender.bare).name
|
| 323 | 323 | else:
|
| 324 | - type_ = Q_('?Noun:Upload')
|
|
| 324 | + type_ = p_('Noun', 'Upload')
|
|
| 325 | 325 | actor = _('Recipient: ')
|
| 326 | 326 | receiver = JID.from_string(file_prop.receiver)
|
| 327 | 327 | name = client.get_module('Contacts').get_contact(
|
| 328 | 328 | receiver.bare).name
|
| 329 | - properties.append((Q_('?transfer type:Type: '), type_))
|
|
| 329 | + properties.append((p_('File transfer type', 'Type: '), type_))
|
|
| 330 | 330 | properties.append((actor, GLib.markup_escape_text(name)))
|
| 331 | 331 | |
| 332 | 332 | transferred_len = file_prop.received_len
|
| 333 | 333 | if not transferred_len:
|
| 334 | 334 | transferred_len = 0
|
| 335 | - properties.append((Q_('?transfer status:Transferred: '),
|
|
| 335 | + properties.append((p_('File transfer state', 'Transferred: '),
|
|
| 336 | 336 | GLib.format_size_full(transferred_len, self.units)))
|
| 337 | 337 | status = self._get_current_status(file_prop)
|
| 338 | - properties.append((Q_('?transfer status:Status: '), status))
|
|
| 338 | + properties.append((p_('File transfer state', 'Status: '), status))
|
|
| 339 | 339 | file_desc = file_prop.desc or ''
|
| 340 | 340 | properties.append((_('Description: '),
|
| 341 | 341 | GLib.markup_escape_text(file_desc)))
|
| ... | ... | @@ -361,17 +361,17 @@ def _create_tooltip(self, file_prop: FileProp, _sid: str) -> Gtk.Grid: |
| 361 | 361 | @staticmethod
|
| 362 | 362 | def _get_current_status(file_prop: FileProp) -> str:
|
| 363 | 363 | if file_prop.stopped:
|
| 364 | - return Q_('?transfer status:Aborted')
|
|
| 364 | + return p_('File transfer state', 'Aborted')
|
|
| 365 | 365 | if file_prop.completed:
|
| 366 | - return Q_('?transfer status:Completed')
|
|
| 366 | + return p_('File transfer state', 'Completed')
|
|
| 367 | 367 | if file_prop.paused:
|
| 368 | - return Q_('?transfer status:Paused')
|
|
| 368 | + return p_('File transfer state', 'Paused')
|
|
| 369 | 369 | if file_prop.stalled:
|
| 370 | 370 | # stalled is not paused. it is like 'frozen' it stopped alone
|
| 371 | - return Q_('?transfer status:Stalled')
|
|
| 371 | + return p_('File transfer state', 'Stalled')
|
|
| 372 | 372 | |
| 373 | 373 | if file_prop.connected:
|
| 374 | 374 | if file_prop.started:
|
| 375 | - return Q_('?transfer status:Transferring')
|
|
| 376 | - return Q_('?transfer status:Not started')
|
|
| 377 | - return Q_('?transfer status:Not started') |
|
| 375 | + return p_('File transfer state', 'Transferring')
|
|
| 376 | + return p_('File transfer state', 'Not started')
|
|
| 377 | + return p_('File transfer state', 'Not started') |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | from nbxmpp.modules.vcard4 import VCard
|
| 26 | 26 | |
| 27 | 27 | from gajim.common.i18n import _
|
| 28 | -from gajim.common.i18n import Q_
|
|
| 28 | +from gajim.common.i18n import p_
|
|
| 29 | 29 | from gajim.common.const import URIType
|
| 30 | 30 | from gajim.common.helpers import open_uri
|
| 31 | 31 | from gajim.common.helpers import parse_uri
|
| ... | ... | @@ -40,16 +40,16 @@ |
| 40 | 40 | 'n': _('Name'),
|
| 41 | 41 | 'bday': _('Birthday'),
|
| 42 | 42 | 'gender': _('Gender'),
|
| 43 | - 'adr': Q_('?profile:Address'),
|
|
| 43 | + 'adr': p_('Profile', 'Address'),
|
|
| 44 | 44 | 'tel': _('Phone No.'),
|
| 45 | 45 | 'email': _('Email'),
|
| 46 | - 'impp': _('IM Address'),
|
|
| 47 | - 'title': Q_('?profile:Title'),
|
|
| 48 | - 'role': Q_('?profile:Role'),
|
|
| 49 | - 'org': _('Organisation'),
|
|
| 50 | - 'note': Q_('?profile:Note'),
|
|
| 46 | + 'impp': p_('Profile', 'IM Address'),
|
|
| 47 | + 'title': p_('Profile', 'Title'),
|
|
| 48 | + 'role': p_('Profile', 'Role'),
|
|
| 49 | + 'org': p_('Profile', 'Organisation'),
|
|
| 50 | + 'note': p_('Profile', ':Note'),
|
|
| 51 | 51 | 'url': _('URL'),
|
| 52 | - 'key': Q_('?profile:Public Encryption Key'),
|
|
| 52 | + 'key': p_('Profile', 'Public Encryption Key'),
|
|
| 53 | 53 | }
|
| 54 | 54 | |
| 55 | 55 | |
| ... | ... | @@ -118,8 +118,8 @@ |
| 118 | 118 | SEX_VALUES = {
|
| 119 | 119 | 'M': _('Male'),
|
| 120 | 120 | 'F': _('Female'),
|
| 121 | - 'O': Q_('?Gender:Other'),
|
|
| 122 | - 'N': Q_('?Gender:None'),
|
|
| 121 | + 'O': p_('Gender', 'Other'),
|
|
| 122 | + 'N': p_('Gender', 'None'),
|
|
| 123 | 123 | 'U': _('Unknown')
|
| 124 | 124 | }
|
| 125 | 125 |