Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/common/i18n.py
    ... ... @@ -155,6 +155,10 @@ def Q_(text: str) -> str:
    155 155
         return text
    
    156 156
     
    
    157 157
     
    
    158
    +def P_(context: str, message: str) -> str:
    
    159
    +    return _translation.pgettext(context, message)
    
    160
    +
    
    161
    +
    
    158 162
     def ngettext(s_sing: str,
    
    159 163
                  s_plural: str,
    
    160 164
                  n: int,
    
    ... ... @@ -194,12 +198,13 @@ def ngettext(s_sing: str,
    194 198
             _translation = gettext.translation(DOMAIN, dir_)
    
    195 199
             _ = _translation.gettext
    
    196 200
             if hasattr(locale, 'bindtextdomain'):
    
    197
    -            locale.bindtextdomain(DOMAIN, dir_)  # type: ignore
    
    201
    +            locale.bindtextdomain(DOMAIN, dir_)
    
    198 202
         except OSError:
    
    199 203
             continue
    
    200 204
         else:
    
    201 205
             break
    
    206
    +
    
    202 207
     else:
    
    203
    -    print('No translations found', file=sys.stderr)
    
    204
    -    print('Dirs searched: %s' % get_locale_dirs(), file=sys.stderr)
    
    205 208
         _ = _translation.gettext
    
    209
    +    print('No translations found for', LANG, file=sys.stderr)
    
    210
    +    print('Dirs searched: %s' % get_locale_dirs(), file=sys.stderr)

  • scripts/update_translations.py
    ... ... @@ -45,6 +45,7 @@ def update_translation_template() -> bool:
    45 45
             '-c#',
    
    46 46
             '--from-code=utf-8',
    
    47 47
             '--keyword=Q_',
    
    48
    +        '--keyword=P_:1c,2',
    
    48 49
             '--no-location',
    
    49 50
             '--sort-output',
    
    50 51
             '--package-name=Gajim'