Code Monkey home page Code Monkey logo

Comments (4)

jayaddison avatar jayaddison commented on September 28, 2024 2

(issue labels updated; let me know if those seem accurate/inaccurate)

from sphinx.

n-peugnet avatar n-peugnet commented on September 28, 2024

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.

from sphinx.

hwhsu1231 avatar hwhsu1231 commented on September 28, 2024

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?

from sphinx.

n-peugnet avatar n-peugnet commented on September 28, 2024

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.

from sphinx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.