mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
make seealso translatable
This commit is contained in:
parent
29f768e48f
commit
13850c478d
@ -222,7 +222,8 @@ class SeeAlso(Directive):
|
|||||||
if self.arguments:
|
if self.arguments:
|
||||||
argnodes, msgs = self.state.inline_text(self.arguments[0],
|
argnodes, msgs = self.state.inline_text(self.arguments[0],
|
||||||
self.lineno)
|
self.lineno)
|
||||||
para = nodes.paragraph()
|
para = nodes.paragraph(self.arguments[0], '')
|
||||||
|
set_source_info(self, para)
|
||||||
para += argnodes
|
para += argnodes
|
||||||
para += msgs
|
para += msgs
|
||||||
ret[0].insert(1, para)
|
ret[0].insert(1, para)
|
||||||
|
@ -5,3 +5,4 @@
|
|||||||
footnote
|
footnote
|
||||||
external_links
|
external_links
|
||||||
refs_inconsistency
|
refs_inconsistency
|
||||||
|
seealso
|
||||||
|
33
tests/root/i18n/seealso.po
Normal file
33
tests/root/i18n/seealso.po
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) 2010, Georg Brandl & Team
|
||||||
|
# This file is distributed under the same license as the Sphinx <Tests> package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Sphinx <Tests> 0.6\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2012-12-16 06:06\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 "i18n with seealso"
|
||||||
|
msgstr "I18N WITH SEEALSO"
|
||||||
|
|
||||||
|
msgid "short text 1"
|
||||||
|
msgstr "SHORT TEXT 1"
|
||||||
|
|
||||||
|
msgid "long text 1"
|
||||||
|
msgstr "LONG TEXT 1"
|
||||||
|
|
||||||
|
msgid "short text 2"
|
||||||
|
msgstr "SHORT TEXT 2"
|
||||||
|
|
||||||
|
msgid "long text 2"
|
||||||
|
msgstr "LONG TEXT 2"
|
||||||
|
|
15
tests/root/i18n/seealso.txt
Normal file
15
tests/root/i18n/seealso.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
:tocdepth: 2
|
||||||
|
|
||||||
|
i18n with seealso
|
||||||
|
============================
|
||||||
|
.. #960 directive-seelaso-ignored-in-the-gettext
|
||||||
|
|
||||||
|
.. seealso:: short text 1
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
|
||||||
|
long text 1
|
||||||
|
|
||||||
|
.. seealso:: short text 2
|
||||||
|
|
||||||
|
long text 2
|
@ -184,3 +184,22 @@ def test_i18n_keep_external_links(app):
|
|||||||
if matched:
|
if matched:
|
||||||
matched_line = matched.group()
|
matched_line = matched.group()
|
||||||
assert expect_line == matched_line
|
assert expect_line == matched_line
|
||||||
|
|
||||||
|
|
||||||
|
@with_app(buildername='text', cleanenv=True,
|
||||||
|
confoverrides={'language': 'xx', 'locale_dirs': ['.'],
|
||||||
|
'gettext_compact': False})
|
||||||
|
def test_seealso(app):
|
||||||
|
app.builddir.rmtree(True)
|
||||||
|
app.builder.build(['i18n/seealso'])
|
||||||
|
result = (app.outdir / 'i18n' / 'seealso.txt').text(encoding='utf-8')
|
||||||
|
expect = (u"\nI18N WITH SEEALSO"
|
||||||
|
u"\n*****************\n"
|
||||||
|
u"\nSee also:\n"
|
||||||
|
u"\n SHORT TEXT 1\n"
|
||||||
|
u"\nSee also:\n"
|
||||||
|
u"\n LONG TEXT 1\n"
|
||||||
|
u"\nSee also:\n"
|
||||||
|
u"\n SHORT TEXT 2\n"
|
||||||
|
u"\n LONG TEXT 2\n")
|
||||||
|
assert result == expect
|
||||||
|
Loading…
Reference in New Issue
Block a user