Mercurial > hg
comparison tests/test-i18n.t @ 34660:d00ec62d156f
i18n: cache translated messages per encoding
This is a simpler workaround alternative to D958, "i18n: clean msgcache when
encoding changes." The cache won't be bloated unless you run tons of commands
with different --encoding options on command server, or serve many repositories
of different web.encoding options on hgweb.
The test was originally written by Jun Wu.
Differential Revision: https://phab.mercurial-scm.org/D1053
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 13 Oct 2017 21:36:10 +0900 |
parents | 75be14993fda |
children | a88166a4dce3 |
comparison
equal
deleted
inserted
replaced
34659:3edfd472f3cb | 34660:d00ec62d156f |
---|---|
46 | 46 |
47 $ cd "$TESTDIR"/../i18n | 47 $ cd "$TESTDIR"/../i18n |
48 $ $PYTHON check-translation.py *.po | 48 $ $PYTHON check-translation.py *.po |
49 $ $PYTHON check-translation.py --doctest | 49 $ $PYTHON check-translation.py --doctest |
50 $ cd $TESTTMP | 50 $ cd $TESTTMP |
51 | |
52 Check i18n cache isn't reused after encoding change: | |
53 | |
54 $ cat > $TESTTMP/encodingchange.py << EOF | |
55 > from mercurial import encoding, registrar | |
56 > from mercurial.i18n import _ | |
57 > cmdtable = {} | |
58 > command = registrar.command(cmdtable) | |
59 > @command(b'encodingchange', norepo=True) | |
60 > def encodingchange(ui): | |
61 > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'): | |
62 > encoding.encoding = encode | |
63 > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)')) | |
64 > EOF | |
65 | |
66 $ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange | |
67 (?????) | |
68 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc) | |
69 (?????) | |
70 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc) |