简体   繁体   中英

Is there a way to make gettext comment extractor look for the inline comments of a string rather than the line before?

This is a small snippet of my code:

#SUBTRACTION
       elif _("sub") in calc: #FOR TRANSLATORS: This is a translated if statement. Dont add accents. Use a key part of the word e.g. sub instead of subtract instead of the full word if possible.
           misc.showUserWhatIThink(_("subtract a number from a number"))
           TheBasics.subtraction()

Poedit (gettext) would assign the comment FOR TRANSLATORS: This is a translated if statement. [...] FOR TRANSLATORS: This is a translated if statement. [...] to subtract a number from a number rather than sub . I want the comment for "sub" to be on the "notes for translators" section.

Is there any way to circumvent this? I've already added the same comment over and over again inline; I don't want to redo all that.

It is not possible.

And since it would require a major change to the extractor logic to make the comment placement more flexible, it is highly unlikely that this will ever change.

If it is mission-critical for you: Preparse your sources with a little script, and if you find #TRANSLATORS comments, extract them into a line above the invocation of _() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM