summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa@gmail.com>2013-07-03 08:19:10 +0000
committerTakayuki Shimizukawa <shimizukawa@gmail.com>2013-07-03 08:19:10 +0000
commit33c9e1fb283eaaddb12841dee97738e10e8d7e99 (patch)
treed173e35160de12387a0c9542c4f4360eb2a61d2a /tests
parentcb1124675421270fb821b42e4ac5f7bbcad2b6cb (diff)
downloadsphinx-git-33c9e1fb283eaaddb12841dee97738e10e8d7e99.tar.gz
Fix i18n: gettext did not translate admonition directive's title. Closes #1206
Diffstat (limited to 'tests')
-rw-r--r--tests/roots/test-intl/admonitions.po81
-rw-r--r--tests/roots/test-intl/admonitions.txt46
-rw-r--r--tests/test_intl.py14
3 files changed, 141 insertions, 0 deletions
diff --git a/tests/roots/test-intl/admonitions.po b/tests/roots/test-intl/admonitions.po
new file mode 100644
index 000000000..0dd163764
--- /dev/null
+++ b/tests/roots/test-intl/admonitions.po
@@ -0,0 +1,81 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) 2013, test_intl
+# This file is distributed under the same license as the foo package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sphinx 1.2\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-03 12:00\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "Admonitions"
+msgstr "ADMONITIONS"
+
+msgid "attention title"
+msgstr "ATTENTION TITLE"
+
+msgid "attention body"
+msgstr "ATTENTION BODY"
+
+msgid "caution title"
+msgstr "CAUTION TITLE"
+
+msgid "caution body"
+msgstr "CAUTION BODY"
+
+msgid "danger title"
+msgstr "DANGER TITLE"
+
+msgid "danger body"
+msgstr "DANGER BODY"
+
+msgid "error title"
+msgstr "ERROR TITLE"
+
+msgid "error body"
+msgstr "ERROR BODY"
+
+msgid "hint title"
+msgstr "HINT TITLE"
+
+msgid "hint body"
+msgstr "HINT BODY"
+
+msgid "important title"
+msgstr "IMPORTANT TITLE"
+
+msgid "important body"
+msgstr "IMPORTANT BODY"
+
+msgid "note title"
+msgstr "NOTE TITLE"
+
+msgid "note body"
+msgstr "NOTE BODY"
+
+msgid "tip title"
+msgstr "TIP TITLE"
+
+msgid "tip body"
+msgstr "TIP BODY"
+
+msgid "warning title"
+msgstr "WARNING TITLE"
+
+msgid "warning body"
+msgstr "WARNING BODY"
+
+msgid "admonition title"
+msgstr "ADMONITION TITLE"
+
+msgid "admonition body"
+msgstr "ADMONITION BODY"
+
diff --git a/tests/roots/test-intl/admonitions.txt b/tests/roots/test-intl/admonitions.txt
new file mode 100644
index 000000000..170b8ed57
--- /dev/null
+++ b/tests/roots/test-intl/admonitions.txt
@@ -0,0 +1,46 @@
+:tocdepth: 2
+
+Admonitions
+==================
+.. #1206 gettext did not translate admonition directive's title
+
+.. attention:: attention title
+
+ attention body
+
+.. caution:: caution title
+
+ caution body
+
+.. danger:: danger title
+
+ danger body
+
+.. error:: error title
+
+ error body
+
+.. hint:: hint title
+
+ hint body
+
+.. important:: important title
+
+ important body
+
+.. note:: note title
+
+ note body
+
+.. tip:: tip title
+
+ tip body
+
+.. warning:: warning title
+
+ warning body
+
+.. admonition:: admonition title
+
+ admonition body
+
diff --git a/tests/test_intl.py b/tests/test_intl.py
index ef412c1df..67ab95781 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -593,6 +593,20 @@ def test_i18n_docfields(app):
assert result == expect
+@with_intl_app(buildername='text', cleanenv=True)
+def test_i18n_admonitions(app):
+ # #1206: gettext did not translate admonition directive's title
+ # seealso: http://docutils.sourceforge.net/docs/ref/rst/directives.html#admonitions
+ app.builder.build(['admonitions'])
+ result = (app.outdir / 'admonitions.txt').text(encoding='utf-8')
+ directives = (
+ "attention", "caution", "danger", "error", "hint",
+ "important", "note", "tip", "warning", "admonition",)
+ for d in directives:
+ assert d.upper() + " TITLE" in result
+ assert d.upper() + " BODY" in result
+
+
@with_intl_app(buildername='html', cleanenv=True)
def test_i18n_docfields_html(app):
app.builder.build(['docfields'])