tests/test-i18n.t
author Alexander Plavin <me@aplavin.ru>
Thu, 04 Jul 2013 14:18:44 +0400
changeset 19387 f2e4fdb3dd27
parent 17015 73d20de5f30b
child 20152 84939b728749
permissions -rw-r--r--
hgweb: code selection without line numbers in file source view All the source lines are put in a <pre> tag, which gives correct display and copy&paste in both Chromium (WebKit) and FireFox: line numbers are not copied, all the tabs and spaces are kept. This doesn't change the visual appearance of the view compared to current hgweb version and doesn't use any JS code. Also, stripes in this view are now generated clientside with CSS. This implementation is chosen because other variants have important issues: Strategy FF Chrome current D,LT,E,T,L D,L pre S,NW S,NW pre/div/nbsp LT,E,T,TS,NW TS,NW pre/div/br LT,E,T,NW NW ol/li/nbsp LT,E,T,TS,AJ TS,AJ ol/li/br LT,E,T,AJ AJ pre/span LV LV Legend Strategies: - current: implemented in hgweb before this patch, i.e. divs for each line, and line numbers links in the div too - pre: the whole code in one pre tag with newlines, all line numbers in another one with 'float: left' - pre/div/{nbsp,br}: same as just 'pre', but separate divs for each line and &nbsp; or <br> instead of empty lines (otherwise they are not copied at all) - ol/li/{nbsp,br}: a single ol with li's and divs for each line, &nbsp; or <br> same as in previous strategy - pre/span: this patch Problems: D = (very minor) display problems, like wrong width of leading tabs LT = loses leading/trailing whitespace E = loses embedded whitespace B = loses blank lines T = loses tabs L = selects line numbers LV = (only) visually selects line numbers LVE = (only) visually selects line numbers at empty lines S = no stripes (and no ability to easily highlight lines-which-are-linked-at in the future) TS = space copied instead of empty line AJ = get anchor links only with JS (they work even without) NW = no linewrap easily possible (in future) As for browser versions compatibility, the CSS tricks used are supported in (according to caniuse.com): a) line numbers generation with 'content:' property and CSS counters: IE 8+, all other popular browsers (in pre-WebKit Opera numbers are being copied) b) stripes ('nth-child' selector): IE 8+, FF 3.5+, Safari 3.2+, Opera 9.5+, all other popular browsers c) line numbers are not visually selected ('user-select:' property): IE 10+, Opera 15.0+, all other popular browsers This patch is based on a demo implementation by Martin Geisler <martin@geisler.net>.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13442
bb107a31820e test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents: 13414
diff changeset
     1
Translations are optional:
bb107a31820e test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents: 13414
diff changeset
     2
bb107a31820e test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents: 13414
diff changeset
     3
  $ "$TESTDIR/hghave" gettext || exit 80
bb107a31820e test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents: 13414
diff changeset
     4
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16981
diff changeset
     5
#if no-outer-repo
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16981
diff changeset
     6
13414
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
     7
Test that translations are compiled and installed correctly.
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
     8
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
     9
Default encoding in tests is "ascii" and the translation is encoded
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    10
using the "replace" error handler:
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    11
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    12
  $ LANGUAGE=pt_BR hg tip
14920
56848e2bb0c5 test-i18n, i18n-pt_BR: updated test message changed in 41c3a71c318d
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 14914
diff changeset
    13
  abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
13414
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    14
  [255]
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    15
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    16
Using a more accomodating encoding:
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    17
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    18
  $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
14920
56848e2bb0c5 test-i18n, i18n-pt_BR: updated test message changed in 41c3a71c318d
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 14914
diff changeset
    19
  abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
13414
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    20
  [255]
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    21
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    22
Different encoding:
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    23
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    24
  $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
14920
56848e2bb0c5 test-i18n, i18n-pt_BR: updated test message changed in 41c3a71c318d
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 14914
diff changeset
    25
  abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
13414
a0e49e129151 test-i18n: test translations
Martin Geisler <mg@aragost.com>
parents:
diff changeset
    26
  [255]
16895
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    27
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16981
diff changeset
    28
#endif
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 16981
diff changeset
    29
16895
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    30
Test keyword search in translated help text:
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    31
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    32
  $ HGENCODING=UTF-8 LANGUAGE=de hg help -k blättern
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    33
  Topics:
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    34
  
16981
2264e3e39cba tests: fix test-i18n.t after translation update
Mads Kiilerich <mads@kiilerich.com>
parents: 16895
diff changeset
    35
   extensions Benutzung erweiterter Funktionen
16895
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    36
  
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    37
  Erweiterungen:
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    38
  
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    39
   pager Verwendet einen externen Pager zum Bl\xc3\xa4ttern in der Ausgabe von Befehlen (esc)
430714e2a876 help: test keyword search in translated text.
Olav Reinert <seroton10@gmail.com>
parents: 14920
diff changeset
    40