Open hwhsu1231 opened 3 months ago
What did I miss? Is this a bug? Or Is Sphinx's gettext builder designed to be unable to extract
option
directive? Or is it just not able to do it currently, and is required a feature request?
Sphinx's gettext builder is currently explicitly designed to ignore certain strings by default, such as code-blocks, or the option
directive. Though some have been added as optional additional targets, it is usually useful to ignore them as these are strings that are likely not to be changed by translations.
The option
directive simply hasn't been yet added as a possible additional target. But it would not be trivial to add as it is also a cross-reference target, so it would be quite difficult to make it work correctly if the option name is changed in the translations.
Hello, @n-peugnet
The
option
directive simply hasn't been yet added as a possible additional target. But it would not be trivial to add as it is also a cross-reference target, so it would be quite difficult to make it work correctly if the option name is changed in the translations.
What about translating the entry which cross-references the option
directive with the following form:
# Source (msgid)
:option:`--graphviz=<file>`
# Translation (msgstr)
:option:`--graphviz=<檔案> <--graphviz=<file>>`
Just like the way CMake Documentation did in its cmake.1.rst
:manual:`CMake Presets <cmake-presets(7)>`
Is it possible to do so?
What about translating the entry which cross-references the
option
directive with the following form:# Source (msgid) :option:`--graphviz=<file>` # Translation (msgstr) :option:`--graphviz=<檔案> <--graphviz=<file>>`
Translating the option role and adding an explicit target should already possible. You were initially talking about the option directive.
Maybe a simple way to do it would be to only extract the option's example value (=<file>
in your initial example), as it seems like is is already treated differently from the rest, and changing it should not affect the cross-referencing (it is not mandatory in the option role). But I didn't check the code yet, so not sure how complicated it would be and if it really is a good idea.
Anyway, this should be tagged as a feature request as this is not a bug, but I don't have the permissions to change the tags myself.
(issue labels updated; let me know if those seem accurate/inaccurate)
Describe the bug
Hello, Sphinx Maintainance Team.
Recently, I tried to translate CMake Documentation with its .po files generated by Gettext builder. In CMake Documentation, we can see that there is a type of content derived from the Sphinx
option
directive. Take cmake's--graphviz=<file>
as an example:.html
link:--graphviz=<file>
.rst
link:--graphviz=<file>
If possible, I want to translate the
<file>
in the--graphviz=<file>
as well. However, I found that even though I specify all the possible values ingettext_additional_targets
when building with gettext builder:I still don't see the content of
option
directives being extracted into the generatedcmake.1.pot
.What did I miss? Is this a bug? Or Is Sphinx's gettext builder designed to be unable to extract
option
directive? Or is it just not able to do it currently, and is required a feature request?How to Reproduce
Run the following commands in order:
Search
--graphviz=<file>
string in Kate (Ctrl+F).Expected/Actual Result:
--graphviz=<file>
in thecmake.1.pot
.Environment Information
Sphinx extensions
No response
Additional context
Full log of How to Reproduce
Click to expand the full log
```bash hwhsu1231@vb-kubuntu:~/Repo/testing$ git clone --depth=1 --branch=v3.28.4 https://github.com/Kitware/CMake.git Cloning into 'CMake'... remote: Enumerating objects: 21228, done. remote: Counting objects: 100% (21228/21228), done. remote: Compressing objects: 100% (15454/15454), done. remote: Total 21228 (delta 4458), reused 14380 (delta 3547), pack-reused 0 Receiving objects: 100% (21228/21228), 13.11 MiB | 7.55 MiB/s, done. Resolving deltas: 100% (4458/4458), done. Note: switching to 'b5602e7254c8ce4a6f732c017d784cd80559e5aa'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c