##// END OF EJS Templates
test-i18n: guard gettext test appropriately
Yuya Nishihara -
r34689:a88166a4 default
parent child Browse files
Show More
@@ -1,70 +1,74
1 (Translations are optional)
1 (Translations are optional)
2
2
3 #if gettext no-outer-repo
3 #if gettext no-outer-repo
4
4
5 Test that translations are compiled and installed correctly.
5 Test that translations are compiled and installed correctly.
6
6
7 Default encoding in tests is "ascii" and the translation is encoded
7 Default encoding in tests is "ascii" and the translation is encoded
8 using the "replace" error handler:
8 using the "replace" error handler:
9
9
10 $ LANGUAGE=pt_BR hg tip
10 $ LANGUAGE=pt_BR hg tip
11 abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
11 abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
12 [255]
12 [255]
13
13
14 Using a more accommodating encoding:
14 Using a more accommodating encoding:
15
15
16 $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
16 $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
17 abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
17 abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
18 [255]
18 [255]
19
19
20 Different encoding:
20 Different encoding:
21
21
22 $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
22 $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
23 abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
23 abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
24 [255]
24 [255]
25
25
26 #endif
26 #endif
27
27
28 #if gettext
28 #if gettext
29
29
30 Test keyword search in translated help text:
30 Test keyword search in translated help text:
31
31
32 $ HGENCODING=UTF-8 LANGUAGE=de hg help -k Aktualisiert
32 $ HGENCODING=UTF-8 LANGUAGE=de hg help -k Aktualisiert
33 Themen:
33 Themen:
34
34
35 subrepos Unterarchive
35 subrepos Unterarchive
36
36
37 Befehle:
37 Befehle:
38
38
39 pull Ruft \xc3\x84nderungen von der angegebenen Quelle ab (esc)
39 pull Ruft \xc3\x84nderungen von der angegebenen Quelle ab (esc)
40 update Aktualisiert das Arbeitsverzeichnis (oder wechselt die Version)
40 update Aktualisiert das Arbeitsverzeichnis (oder wechselt die Version)
41
41
42 #endif
42 #endif
43
43
44 Check Mercurial specific translation problems in each *.po files, and
44 Check Mercurial specific translation problems in each *.po files, and
45 tool itself by doctest
45 tool itself by doctest
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
51
52 #if gettext
53
52 Check i18n cache isn't reused after encoding change:
54 Check i18n cache isn't reused after encoding change:
53
55
54 $ cat > $TESTTMP/encodingchange.py << EOF
56 $ cat > $TESTTMP/encodingchange.py << EOF
55 > from mercurial import encoding, registrar
57 > from mercurial import encoding, registrar
56 > from mercurial.i18n import _
58 > from mercurial.i18n import _
57 > cmdtable = {}
59 > cmdtable = {}
58 > command = registrar.command(cmdtable)
60 > command = registrar.command(cmdtable)
59 > @command(b'encodingchange', norepo=True)
61 > @command(b'encodingchange', norepo=True)
60 > def encodingchange(ui):
62 > def encodingchange(ui):
61 > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
63 > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
62 > encoding.encoding = encode
64 > encoding.encoding = encode
63 > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
65 > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
64 > EOF
66 > EOF
65
67
66 $ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
68 $ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
67 (?????)
69 (?????)
68 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
70 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
69 (?????)
71 (?????)
70 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
72 (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
73
74 #endif
General Comments 0
You need to be logged in to leave comments. Login now