Commit Graph

12 Commits

Author SHA1 Message Date
Yuya Nishihara
1a1642aa7c i18n: do not abuse msgstr of "DEPRECATED" to check for bad translation
Because f94973e0eefb requires the msgstr of "(DEPRECATED)", old *.po files
must be blamed. Using "DEPRECATED" would just hide the error.

For example, "LANG=da_DK.UTF-8 hg help serve" fails to hide deprecated
options right now, but check-translation.py couldn't detect it because
da.po has outdated translation of "DEPRECATED".
2015-11-03 22:39:26 +09:00
FUJIWARA Katsunori
6881eb2c6f i18n: look translation of both "DEPRECATED" and "(DEPRECATED)" up
Since f94973e0eefb, deprecated commands, options and so on are
detected by "(DEPRECATED)" instead of "DEPRECATED".

"hg.pot" generated from recent source files doesn't contain msgid
"DEPRECATED", and looking the translation of "DEPRECATED" up in
up-to-date *.po files works incorrectly.

But on the other hand, there are still old *.po files, which contain
msgid "DEPRECATED" but not "(DEPRECATED)". Looking the translation of
"(DEPRECATED)" up in such old *.po files also works incorrectly.

This patch resolves this problem by looking translation of both
"DEPRECATED" and "(DEPRECATED)" up.

This should work correctly, because previous patch makes "deprecated"
checker be applied only on translations, of which msgid contains exact
"(DEPRECATED)" string.

'p.msgstr' examination in 'deprecatedsetup()' is needed to ignore
untranslated entries. This also makes 'deprecatedpe.msgstr'
examination in 'deprecated()' meaningless.
2015-11-01 08:38:56 +09:00
FUJIWARA Katsunori
7c484b491b i18n: fix regexp pattern to detect translation for DEPRECATED
Since f94973e0eefb, deprecated commands, options and so on are
detected by "(DEPRECATED)" instead of "DEPRECATED".

Therefore, 'deprecated' checker in i18n/check-translation.py should
check translation, of which msgid contains "(DEPRECATED)" instead of
"DEPRECATED".

At glance, it seems to do so, but it actually doesn't, because Python
regexp treats "()" as grouping of patterns and "(DEPRECATED)" matches
only against "DEPRECATED".
2015-11-01 08:38:56 +09:00
timeless@mozdev.org
1796c2de4c tests: add more doctests for check-translation deprecated 2015-09-17 21:20:35 -04:00
timeless@mozdev.org
8ab1a3583e tests: cleanup check-translation deprecated 2015-09-17 21:20:17 -04:00
timeless@mozdev.org
cef7f703ed tests: check for inconsistently translated DEPRECATED
Mercurial expects DEPRECATED to be translated consistently,
not doing that breaks Mercurial.
2015-09-17 07:49:18 -04:00
Mads Kiilerich
ecd224f8a0 cleanup: rename check-translation.py checker function - don't hide global var 2014-08-15 16:20:47 +02:00
FUJIWARA Katsunori
8190c758e5 i18n: check equality of initial indentation between msgid and msgstr
Document generation by runrst in "doc" directory may succeed silently,
even though initial indentation is different between msgid and msgstr:
for example, it may be unexpected or missing indentation.

This patch adds the checker to check equality of initial indentation
between msgid and msgstr.

This checker is categorized as "warning" level, because problem
detected by this is not so serious for usual Mercurial usage.
2014-02-15 18:40:39 +09:00
FUJIWARA Katsunori
baee6a2c0f i18n: check equality of tail '::'-ness between msgid and msgstr
Document generation by runrst in "doc" directory may succeed silently,
even though there is the translated message missing tail '::'. In this
case, it uses "<blockquote>" instead of "<pre>" to surround succeeding
text block unexpectedly in generated HTML file.

This patch adds the checker to check equality of tail '::'-ness
between msgid and msgstr.

To detect also msgstr unexpectedly ending with '::', this checker
doesn't have matching regexp against msgid, and is applied on all
msgid/msgstr pairs.

This checker is categorized as "warning" level, because problem
detected by this is not so serious for usual Mercurial usage.
2014-02-15 18:40:39 +09:00
Matt Mackall
68554e4b42 tests: fix missing import in check-translations 2013-12-01 21:24:26 -06:00
Matt Mackall
a7756031f0 tests: fix Mac doctest escape code garbage for check-translations 2013-12-01 20:39:11 -06:00
FUJIWARA Katsunori
3535aee6e1 i18n: add the tool to check Mercurial specific translation problems in *.po
Existing tool like "msgfmt --check" can check typical translation
problems (missing "%s" in msgstr, for example), but can't check
Mercurial specific ones.

For example, "msgfmt --check" can't check whether the translated
string given to "ui.promptchoice()" is correct or not, even though
problems like below cause run-time error or unexpected behavior:

  - less or more choices than msgid,
  - choices without '&', or
  - choices with '&' followed by none

This patch adds the tool to check Mercurial specific translation
problems in *.po files.
2013-11-27 22:47:32 +09:00