-
-
Notifications
You must be signed in to change notification settings - Fork 272
Extract the trans function in separate method #193
Conversation
Extract the trans function in separate method
*/ | ||
protected function getTransFunction($plural = false) | ||
{ | ||
return !$plural ? 'gettext' : 'ngettext'; |
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.
maybe remove the !
and flip the results, save an OP without draw back
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've kept it as it was in the previous version. Will update it now
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.
It's weird but the build fails with the reversed check.
* | ||
* @return string | ||
*/ | ||
protected function getTransFunction($plural = false) |
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.
What about removing the default value?
Thank you @kachar. |
Hi, Thanks a lot for merging this, it's a step in the right direction. However, it's still far from usable, for three reasons:
So basically I don't think #152, #160 and #166 can be considered resolved yet... |
Please, take a look at this for what I think would be a usable solution (from the perspective of the theme developers and users of this library). The extension itself is a horrible, horrible hack and I'd like to get rid of it as soon as possible, but unfortunately we need it until this is resolved here, since we can't rely on the native gettext implementation. |
@jaimeperez you should be able to use a static method: |
Btw, regarding your repo, you should put configuration in the extension constructor instead of extending the Twig environment to get the config from the environment |
I could live with that instead of callables, especially because callables can specify an object instead of a class, and that's not something that you could use in the compiled template. However, the other two reasons remain valid. Regarding how to configure the extension, whether to use the environment or the constructor of the extension itself, using the constructor was my initial idea. The problem is that |
@fabpot, any chance to get this fixed? |
No description provided.