Commit
- Loading branch information
There are no files selected for viewing
5 comments
on commit 7710cf5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, reverted in 64888c0 - I think @candidasa misunderstood the feature, it was only implemented for PHP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is anyone working on this? The javascript _t() implementation is pretty impoverished at the moment. I know any change will require updating a lot of core code, but it certainly seems like something that should be looked at. Replacement ordering is very important for translation.
I'll be implementing a replacement for ss.i18n._t() for a current project which I'll be happy to share, but is unlikely to work as a drop-in replacement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nobody working on it, happy for you to have a crack. Just be aware that it shouldn't have much in terms of dependencies (definitely no entwine), since its designed as a standalone library. jQuery might be fine though. Named param support would be grand!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't expect to need jQuery or entwine anyway since it shouldn't need to hit the DOM at any point. A more wholesale re-implementation might look at using require.js (or that concept) to load the language files rather than the current tight coupling with the PHP Requirements class (which incidentally, also leaves quite a bit to be desired, IMO).
But that's beyond what I can achieve in the next few days - which is the time frame I'm working with. For now I'll just be looking at a simple replacement for _t()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell this section of the documentation in the 3.0 branch refers to functionality that never got implemented in 3.0 (and doesn't look to be implemented in 3.1 either). I see nothing in https://github.com/silverstripe/sapphire/blob/3.0/javascript/i18n.js which would do injection of named replacement, though the sprintf function still exists.
Is that correct or am I missing something?