Open ArmorDarks opened 9 years ago
Haha, this is what I feared when we hard-coded the n
prefix. I believe this is doable, just requires some more effort.
I'll try to get to this soon.
//cc @vrouet
Thanks a lot! :)
Well, in fact some libraries even use another position of arguments. Some going even further and providing chaining (like Jed).
But I guess ability to remap arguments, or define somehow completely custom function would be too hard task. grunt-xgettext tried to implement it, but, unfortunately, they didn't advance much further than just discussion.
Well, in fact some libraries even use another position of arguments. Some going even further and providing chaining (like Jed).
I think the promise of jsxgettext is to support GNU gettext interface as closely as possible. Anything non-standard should not make it into the core package. I even hate the custom template parsers but that needs a larger refactor.
I think the promise of jsxgettext is to support GNU gettext interface as closely as possible. Anything non-standard should not make it into the core package.
yeah, I completely agree
Maybe we can support it with regex?
Users which would need only basic functionality could map each function to custom name just with object and strings inside, but if someone will need something custom — regex to the rescue with named regex groups.
For sure we won't provide ready regex for non-trivial systems, like Jed, out of box.
For simpler cases we can also map arguments based on user's input. Here are some thought about it: https://github.com/arendjr/grunt-xgettext/issues/8
For the informations: native xgettext
provides quite flexible way to set custom functions names and map arguments: http://poedit.net/trac/wiki/Doc/Keywords
Some projects uses another gettext function names, like,
_t()
for singular forms and_pt()
for plurals, etc.Is there any chances to see ability pass to jsxgettext object which will map custom function names to
gettext()
,ngettext()
and so on?grunt-xgettext partially implemented that feature, maybe something can be learned from it. Besides, there were issue about even further expending of that feature: https://github.com/arendjr/grunt-xgettext/issues/8