? Success

User tests: Successful: Unsuccessful:

avatar vietvh
vietvh
23 Nov 2016

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

  • Text shows up normally in both language debug ON/OFF
avatar vietvh vietvh - open - 23 Nov 2016
avatar vietvh vietvh - change - 23 Nov 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Nov 2016
Category Libraries
avatar Bakual
Bakual - comment - 23 Nov 2016

I don't understand the usecase for this.

Text shows up normally in both language debug ON/OFF

Wouldn't that basically make the debug function useless?

avatar vietvh
vietvh - comment - 23 Nov 2016

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.

avatar infograf768
infograf768 - comment - 23 Nov 2016

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.

avatar vietvh
vietvh - comment - 23 Nov 2016

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

avatar brianteeman
brianteeman - comment - 23 Nov 2016

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/

avatar ot2sen
ot2sen - comment - 23 Nov 2016

@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?

avatar vietvh
vietvh - comment - 23 Nov 2016

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.

avatar vietvh
vietvh - comment - 23 Nov 2016

@ot2sen Yes, why not, it is a great idea for this feature's use case.

avatar vietvh vietvh - change - 23 Nov 2016
The description was changed
avatar vietvh vietvh - edited - 23 Nov 2016
avatar vietvh vietvh - change - 23 Nov 2016
The description was changed
avatar vietvh vietvh - edited - 23 Nov 2016
avatar brianteeman
brianteeman - comment - 23 Nov 2016

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/

avatar vietvh
vietvh - comment - 23 Nov 2016

@brianteeman

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

avatar Bakual
Bakual - comment - 23 Nov 2016

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 ?

avatar vietvh
vietvh - comment - 23 Nov 2016

The video from Roberto Segura is also a great potential use case of this pull request:

https://www.youtube.com/watch?v=YXsdSiNLV2s

avatar mbabker
mbabker - comment - 23 Nov 2016

?

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)?

avatar Bakual
Bakual - comment - 23 Nov 2016

Closing as there is no support for it.

avatar Bakual Bakual - change - 23 Nov 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-11-23 15:02:25
Closed_By Bakual
avatar Bakual Bakual - close - 23 Nov 2016

Add a Comment

Login with GitHub to post a comment