-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add onAfterTranslate system event #12985
Conversation
I don't understand the usecase for this.
Wouldn't that basically make the debug function useless? |
Let's say if a user does not want to show translated key wrapped in **** characters and untranslated key wrapped in ????, he only want to show the translated key as is (no wrapper) and untranslated key in italic. It is just one minor use case, it can be extended by 3rd ext developers to do other things. At this moment Joomla does not allow hooking at that point and that's the purpose of this pull request. |
We need these when debug as Joomla now loads en-GB strings when they are not present in the language. I also consider this PR as not really useful. |
It does not change anything that could affect the language debug feature, it only allows developers to change the default behavior to suit their needs, and it only increases Joomla's flexibility. It not all about language debug, the use case above is just one minor example how the new event can be utilized. WordPress has similar one for years when it allows 3rd plugins to change the translated key easily: https://github.com/WordPress/WordPress/blob/master/wp-includes/l10n.php#L121-L134 |
Yikes - seriously. You want to allow an extension to completely change On 23 November 2016 at 09:15, Viet Hoang Vu notifications@github.com
Brian Teeman |
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.
Not in favour of this.
@vietvh would a use case be something like connecting with a 3rd party translation tools to do a kind of 'in context translation' of a joomla website? |
Hi Brian, WordPress has that feature for years and I've not seen any problems with it. Do we need to restrict developers to extend Joomla just because we are afraid something bad happened? With the existing event onAfterRender, every plugins can replace the whole website output easily, or with the template override system, a template can totally replace a component's view easily, are those bad features? Hope you get my point. |
@ot2sen Yes, why not, it is a great idea for this feature's use case. |
Joomla !=wordpress On 23 November 2016 at 09:40, Viet Hoang Vu notifications@github.com
Brian Teeman |
Not sure what you meant specifically. But as a die hard Joomla's fan and a professional Joomla developer for 10 years, with nearly 2 years working with WordPress recently in parallel, I'd say to some extent: Joomla's flexibility != WordPress's flexibility |
@ot2sen That's already possible as it is. Just install https://github.com/Bakual/crowdinachug/releases follow the instruction and start translating 😄 |
The video from Roberto Segura is also a great potential use case of this pull request: |
👎 A translation system should NOT have a hook where a plugin can alter the translated string. Your use case is you want to change the debug markers. Move them to class level properties that can be altered instead of hardcoded into the method directly and that gives you the flexibility you want. I honestly could care less what WordPress is doing. Just because they do something does not make it right by any measure. This is something that is not right at all, if a plugin can change the result of a translation then it effectively cripples the translation system and makes user expectations and experience much more complex. Now speaking purely on a technical perspective. How is this going to cripple performance since you are dispatching an event every time a string is translated (and that can easily be 500 strings on a page)? |
Closing as there is no support for it. |
Pull Request to add onAfterTranslate system event
Summary of Changes
Add new onAfterTranslate event, allow hooking after the key is translated.
An example use case: It'd be great if Joomla allows developers to override the default "**" (for translated key) and "??" (for untranslated key) characters when language debug is enabled.
Another use case (from @ot2sen): in context (in line) translation for Joomla
Testing Instructions