User tests: Successful: Unsuccessful:
Pull Request to add onAfterTranslate system event
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
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
strings from anywhere including other extensions?
On 23 November 2016 at 09:15, Viet Hoang Vu notifications@github.com
wrote:
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—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#12985 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8cMzUe5iOceADGyJ4Nz3dzhoZ695ks5rBAQcgaJpZM4K6Uk4
.
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/
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.
Joomla !=wordpress
On 23 November 2016 at 09:40, Viet Hoang Vu notifications@github.com
wrote:
@ot2sen https://github.com/ot2sen Yes, why not, it is a great idea for
this feature's use case.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#12985 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8X5-J_l8sg_eT3kYYAdn4sWrxvZZks5rBAofgaJpZM4K6Uk4
.
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/
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
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?
@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.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-11-23 15:02:25 |
Closed_By | ⇒ | Bakual |
I don't understand the usecase for this.
Wouldn't that basically make the debug function useless?