perchlabs / gettext-volt

MIT License
4 stars 0 forks source link

Support msgctxt for keyword parameter #5

Open dschissler opened 8 years ago

dschissler commented 8 years ago

https://github.com/gmarty/xgettext/issues/56

smhg commented 8 years ago

Thanks for following up on this so quickly.

You might have noticed, but where parsers got sent something like ({ _: [0], gettext: [0], ngettext: [0, 1]}) before, the position arrays inside got extended with 3 props (msgid, msgid_plural and msgctxt). The previous example becomes { _: [0, msgid: 0], gettext: [0, msgid: 0], ngettext: [0, 1, msgid: 0, msgid_plural:1]}. It is a bit of a hack to manipulate the arrays, but this doesn't break the parsers while still enabling a more flexible spec.

It would be best if you could use the same default as gettext-handlebars. That way the old format can disappear someday.

Afterwards, you can indeed use the msgctxt property to parse for contexts.

dschissler commented 8 years ago

I won't be able to get to this for quite a while but its on my list.

dschissler commented 7 years ago

@Zaszczyk I'll fix this after my Phalcon book is 100% finalized and sent to the printer (in hopefull 7-10 days).

dschissler commented 7 years ago

I plan to start implementing this next week. @smhg Is this super complicated to do? I don't really have any idea about the scope of the changes.

smhg commented 7 years ago

If you want to follow the same order of changes in gettext-handlebars, look at these commits:

  1. Support msgctxt
  2. Use new parameter format (mentioned above)
dschissler commented 7 years ago

Thanks.