mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix gettext does not extract glossary terms. Closes #1090
This commit is contained in:
parent
de1f19da36
commit
6f4764f77b
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
||||
Release 1.2 (in development)
|
||||
============================
|
||||
|
||||
* #1090: Fix gettext does not extract glossary terms.
|
||||
|
||||
* #1070: Avoid un-pickling issues when running Python 3 and the saved
|
||||
environment was created under Python 2.
|
||||
|
||||
|
@ -22,7 +22,7 @@ from sphinx.locale import l_, _
|
||||
from sphinx.domains import Domain, ObjType
|
||||
from sphinx.directives import ObjectDescription
|
||||
from sphinx.util import ws_re
|
||||
from sphinx.util.nodes import clean_astext, make_refnode
|
||||
from sphinx.util.nodes import clean_astext, make_refnode, set_source_info
|
||||
from sphinx.util.compat import Directive
|
||||
|
||||
|
||||
@ -313,6 +313,8 @@ class Glossary(Directive):
|
||||
# make a single "term" node with all the terms, separated by termsep
|
||||
# nodes (remove the dangling trailing separator)
|
||||
term = nodes.term('', '', *termnodes[:-1])
|
||||
set_source_info(self, term)
|
||||
term.rawsource = term.astext()
|
||||
term['ids'].extend(ids)
|
||||
term['names'].extend(ids)
|
||||
term += system_messages
|
||||
|
32
tests/roots/test-intl/glossary_terms.po
Normal file
32
tests/roots/test-intl/glossary_terms.po
Normal file
@ -0,0 +1,32 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) 2012, foof
|
||||
# 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.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-01-29 14:10\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 glossary terms"
|
||||
msgstr "I18N WITH GLOSSARY TERMS"
|
||||
|
||||
msgid "Some term"
|
||||
msgstr "SOME TERM"
|
||||
|
||||
msgid "The corresponding glossary"
|
||||
msgstr "THE CORRESPONDING GLOSSARY"
|
||||
|
||||
msgid "Some other term"
|
||||
msgstr "SOME OTHER TERM"
|
||||
|
||||
msgid "The corresponding glossary #2"
|
||||
msgstr "THE CORRESPONDING GLOSSARY #2"
|
13
tests/roots/test-intl/glossary_terms.txt
Normal file
13
tests/roots/test-intl/glossary_terms.txt
Normal file
@ -0,0 +1,13 @@
|
||||
:tocdepth: 2
|
||||
|
||||
i18n with glossary terms
|
||||
========================
|
||||
|
||||
.. glossary::
|
||||
|
||||
Some term
|
||||
The corresponding glossary
|
||||
|
||||
Some other term
|
||||
The corresponding glossary #2
|
||||
|
@ -252,6 +252,21 @@ def test_i18n_definition_terms(app):
|
||||
assert result == expect
|
||||
|
||||
|
||||
@with_intl_app(buildername='text')
|
||||
def test_i18n_glossary_terms(app):
|
||||
# regression test for #1090
|
||||
app.builder.build(['glossary_terms'])
|
||||
result = (app.outdir / 'glossary_terms.txt').text(encoding='utf-8')
|
||||
expect = (u"\nI18N WITH GLOSSARY TERMS"
|
||||
u"\n************************\n"
|
||||
u"\nSOME TERM"
|
||||
u"\n THE CORRESPONDING GLOSSARY\n"
|
||||
u"\nSOME OTHER TERM"
|
||||
u"\n THE CORRESPONDING GLOSSARY #2\n")
|
||||
|
||||
assert result == expect
|
||||
|
||||
|
||||
@with_intl_app(buildername='text')
|
||||
def test_seealso(app):
|
||||
app.builder.build(['seealso'])
|
||||
|
Loading…
Reference in New Issue
Block a user