This commit reverts part of 5976facae92c commit:
Refactor comment generating code for message catalogs.
The commit says "Refactor" but it changes original code behavior.
In original code, start path for path.relpath() is self.outdir but
in refactored code, start path for path.relpath() is self.srcdir.
It should be self.outdir not self.srcdir to improve po-mode.el
support. po-mode.el has "po-cycle-source-reference" command. It
search source code relative from .po file directory.
See also::
http://www.gnu.org/s/hello/manual/gettext/C-Sources-Context.html
Program source files are usually found relative to where the PO
file stands. As a special provision, when this fails, the file
is also looked for, but relative to the directory immediately
above it.
Previously, the includehidden method argument was only being taken into account
for top level toctrees. This meant that hidden subtree toctrees were still
being resolved if they exists below a non-hidden toctree.
We get the following error message when we have a translated admonition
(e.g. 'note') label:
Exception occurred:
File "../sphinx/sphinx/locale/__init__.py", line 75, in __str__
return str(self.data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
From "3 The Format of PO Files" at
http://www.gnu.org/s/hello/manual/gettext/PO-Files.html ::
Comment lines starting with #: contain references to the program's
source code.
The reference comment is useful to jump to the source position.
GNU gettext tools support the reference comment. e.g.: po-mode.el binds
"s" key to "po-cycle-source-reference" that opens a source position in
a new buffer.
Without this patch, adding extra, relevant terms to a search can eliminate a
direct match for an object, because multi-word searches don't do object
lookups.
We can avoid matching too many objects by requiring the other terms searched
to appear in the object name or description.