Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for comments in JavaScript annotations #77

Open
p4t5h3 opened this issue Oct 11, 2018 · 6 comments
Open

Add support for comments in JavaScript annotations #77

p4t5h3 opened this issue Oct 11, 2018 · 6 comments

Comments

@p4t5h3
Copy link

p4t5h3 commented Oct 11, 2018

Translation comments are only supported when using the v-translate directive or <translate> component but not for plain JavaScript annotations. To add support, I thought about two options.

The first is extending the existing functions with an optional parameter like this:

vm.$gettext(msgid, comment = '')
vm.$ngettext(msgid, plural, n, comment = '')
vm.$pgettext(context, msgid, comment = '')
vm.$npgettext(context, msgid, plural, n, comment = '')

The second is probably more complicated during parsing:

vm.$gettext(msgid) //. comment given by the programmer, directed at the translator

The syntax above is derived from GNU gettext utilities documentation. The comment may appear in the same or previous line of the annotation.

@vperron
Copy link
Contributor

vperron commented Oct 11, 2018

I think the first version is way more explicit, and we'll run into less false positives.

@danielrentz
Copy link

The drawback is that translator comments become part of the runtime although they are only needed at build time to generate the catalog (right?)

@vperron
Copy link
Contributor

vperron commented Oct 11, 2018

Sure, but that's how it works in many other languages and implementations.

@danielrentz
Copy link

Fine with me :-D

@JonathanBesson
Copy link

Hello,

something new about that ?
I think the first proposal is the best way do to this !

bests regards

@7iomka
Copy link

7iomka commented Aug 12, 2021

No news on this? :(((

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants