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

Extract comments #6

Open
gabegorelick opened this issue Apr 3, 2015 · 5 comments
Open

Extract comments #6

gabegorelick opened this issue Apr 3, 2015 · 5 comments

Comments

@gabegorelick
Copy link
Contributor

gettext has the notion of "extracted comments." These are comments from the developers designed to aid the translators, e.g:

// Please leave %s in your translation. It is a variable.
gettext("Foo %s");

Obviously, you need to get creative in how the same is done in a markup language. Maybe a sub-expression?

@gabegorelick
Copy link
Contributor Author

I'll probably implement this using subexpressions, e.g.

{{_ "foo" "bar" (i18n-comment "comment")}}

@smhg
Copy link
Owner

smhg commented Apr 13, 2015

Isn't it possible to use Handlebars comments like so:

{{! Extra information about this sentence.}}
{{_ "This should be translated."}}

It would match gettext in other languages.

And can it be triggered by an addComments option?
With a value matching the --add-comments argument in xgettext?

I ask because gmarty/xgettext is an attempt to mimic GNU's xgettext (for template languages). It is where this project is mainly used.

@gabegorelick
Copy link
Contributor Author

FYI, I ended up forking this project to implement some more features. For one thing, I don't need to use gmarty/xgettext (I plan on using build tools instead of a command line tool). gmarty/xgettext's API is also very limited, e.g. no domains, so I feel no reason to maintain backwards compatibility.

Feel free to cherry-pick whatever features you want. I may contribute some of them back to here if I have time.

@smhg
Copy link
Owner

smhg commented Apr 20, 2015

I might have been a bit quick pushing you to contribute. I'm sorry, but I am a bit short on time this month.

I do think it is crucial this project can be used stand-alone. It isn't just a library for gmarty/xgettext.
It is gmarty/xgettext that needs to adapt to extra parameters and API changes. To the extent that there is some common API for other template language parsers to rely on.

This might not have been clear, but I'm very appreciative of your work to take this project to a better level of gettext-feature support.

The only "guideline" I used up until now were xgettext's CLI parameters as a list of possible parameters. Most of which are meant for gmarty/xgettext, but some of which flow through to this library. You think that is too much of a constraint?

@gabegorelick
Copy link
Contributor Author

Sorry for not getting back to you sooner. I have no problem merging my fork back into this project if that's what we decide is best. My only concern is that gettext-handlebars isn't the best name for this project, since it really only implements extraction, not the gettext runtime functions. Obviously not a huge deal, but something to consider.

There's still a bunch of stuff I want to implement in my fork, but then I'll circle back and see what we can merge back up into this project.

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

No branches or pull requests

2 participants