GTranslate plugin don't translate recently. Topic is solved

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
sokrates_mx5
Joomla! Explorer
Joomla! Explorer
Posts: 304
Joined: Tue Mar 24, 2009 12:30 pm

Re: GTranslate plugin don't translate recently.

Post by sokrates_mx5 » Thu Dec 02, 2021 12:04 pm

Thanks, I do apreciate all your explanations.
weltonwms wrote:
Thu Dec 02, 2021 1:05 am
fraig showed the exact point of conflict. I will try to explain what I think happened. Mootools changes the Array.from() function. This function is native to javascript array. mootools in version 1.4.5 does not take into account receiving an object in this function. Possibly before the Google API didn't use Array.from() passing an object and recently started to use it. I think it's hard for someone to do what Mootools did, which is to overwrite something native to Javascript, but the fraig hack is perfect precisely because of that. The hack leaves the mootools code as it is, but when it comes to object conditions, it uses the native Array.from(), javascript's native function.

sokrates_mx5 can trust the fraig hack, as it doesn't change almost anything, it just adds the correct use of Array.from() which is native to javascript.
I will try fraig's hack a bit later and see how it works with the extension being used. First I have to deal with other things, e.g. I have a big "backlog" of content to work through.

weltonwms
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Mar 05, 2017 3:51 pm

Re: GTranslate plugin don't translate recently.

Post by weltonwms » Thu Dec 02, 2021 1:31 pm

If you don't want to face the code, please find attached mootools-core.js with the fraig hack. Just replace that file. You can test it's success. The only modification is:

Code: Select all

old_array_from = Array.from; //this old_array_from is the native Array.from of javascript
//....
:("object" == b(a))
                ?old_array_from(a) // use of javascript's native Array.from for type "object"
//...                
download/file.php?mode=view&id=131917
mootools-core.js
You do not have the required permissions to view the files attached to this post.

sokrates_mx5
Joomla! Explorer
Joomla! Explorer
Posts: 304
Joined: Tue Mar 24, 2009 12:30 pm

Re: GTranslate plugin don't translate recently.

Post by sokrates_mx5 » Thu Dec 02, 2021 9:26 pm

weltonwms wrote:
Thu Dec 02, 2021 1:31 pm
If you don't want to face the code, please find attached mootools-core.js with the fraig hack. Just replace that file.

download/file.php?mode=view&id=131917
mootools-core.js
Thanks for the file. I don't have a problem changing things in the code, but now you made it even easier for me and others when we just need to upload the file :)

I will test it later on.

elwallace
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Sep 06, 2013 8:18 pm

Re: GTranslate plugin don't translate recently.

Post by elwallace » Fri Dec 03, 2021 5:13 pm

I updated the mootools-core.js file on my website with the latest version from mootools.net/core and Gtranslate is now working.

dapinna
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Mar 11, 2012 12:24 am

Re: GTranslate plugin don't translate recently.

Post by dapinna » Fri Dec 03, 2021 6:00 pm

fraig wrote:
Wed Dec 01, 2021 1:55 pm
Hi,
a few days ago, I noticed that GTranslte plugin no longer worked properly and the only error was a console message that said something like "Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)".

I found that this problem was caused by Array.from javascript function rewrite by /media/system/js/mootools-core.js library:

[cut]
Hello,
I tried the change and it works.
I am using Joomla! 3.10.3 and Gtranslate 3.7.6

Tanks
Last edited by toivo on Fri Dec 03, 2021 8:36 pm, edited 1 time in total.
Reason: mod note: missing /quote

sokrates_mx5
Joomla! Explorer
Joomla! Explorer
Posts: 304
Joined: Tue Mar 24, 2009 12:30 pm

Re: GTranslate plugin don't translate recently.

Post by sokrates_mx5 » Mon Dec 13, 2021 9:29 pm

I've been using fraig's hack for some time now and so far so good :)

sokrates_mx5
Joomla! Explorer
Joomla! Explorer
Posts: 304
Joined: Tue Mar 24, 2009 12:30 pm

Re: GTranslate plugin don't translate recently.

Post by sokrates_mx5 » Tue Dec 14, 2021 9:42 pm

Back to square one after upgrading Joomla to 3.10.4 :(

GTranslate stopped working after upgrading Joomla from 3.10.3 to 3.10.4.

Uploaded the file with the hack again and cleared the cache of the browser, and now GTranslate works again :)

simtimbo
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 06, 2017 2:38 am

Re: GTranslate plugin don't translate recently.

Post by simtimbo » Wed Jan 12, 2022 3:54 pm

Great hack thanks for the help... Just find /media/system/js/mootools-core.js and change it out with the hack. Awesome!!!

salazar_joel
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Aug 30, 2018 5:16 pm

Re: GTranslate plugin don't translate recently.

Post by salazar_joel » Thu Mar 03, 2022 10:47 pm

You are a Master!!! It soved the issue and now Gtranslate works great; Thanks!
fraig wrote:
Wed Dec 01, 2021 1:55 pm
Hi,
a few days ago, I noticed that GTranslte plugin no longer worked properly and the only error was a console message that said something like "Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)".

I found that this problem was caused by Array.from javascript function rewrite by /media/system/js/mootools-core.js library:

Code: Select all

Array.from = function(a) {
return null == a ? [] : f.isEnumerable(a) && "string" != typeof a ? "array" == b(a) ? a : e.call(a) : [a]
}
I think the best solution is to disable MooTools javascript library, if possible. In my case other parts depend on it, so I solved the problem by changing the Array.from function as follows:

Code: Select all

// Old code
// Array.from=function(a){return null==
// a?[]:f.isEnumerable(a)&&"string"!=typeof a?"array"==b(a)?a:e.call(a):[a]};

// New code
old_array_from = Array.from;
Array.from=function(a){
    return null==a
        ?[]
        :f.isEnumerable(a)&&"string"!=typeof a
            ?"array"==b(a)
                ?a
                :e.call(a)
            :("object" == b(a))
                ?old_array_from(a)
                :[a];
};
In my case the translation started working again. I hope this solution can be useful. :D

I'm using Joomla! 3.4.6 and GTranslate 3.7.6.

all749
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Jan 07, 2022 4:42 pm

Re: GTranslate plugin don't translate recently.

Post by all749 » Wed May 18, 2022 8:17 am

weltonwms wrote:
Thu Dec 02, 2021 1:31 pm
If you don't want to face the code, please find attached mootools-core.js with the fraig hack. Just replace that file. You can test it's success. The only modification is:

Code: Select all

old_array_from = Array.from; //this old_array_from is the native Array.from of javascript
//....
:("object" == b(a))
                ?old_array_from(a) // use of javascript's native Array.from for type "object"
//...                
download/file.php?mode=view&id=131917
mootools-core.js
Great solution, it's a machine. Thank you very much it worked for 3.10.4 and Gtranslate 3.7.6, but when updating joomla it stops working. I tried with the same solution, but it doesn't work, does it work for anyone?
Can you help me for version 3.10.9?

nicedive4u
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Jul 03, 2022 4:06 pm

Re: GTranslate plugin don't translate recently.

Post by nicedive4u » Sun Aug 14, 2022 9:31 am

Thank you sooooo much! It works perfect with my plugin RokSprocket and GTranslate, Joomla 3.10.
Before it was not translating any pages with RokSprocket modules, now it does.
Great job!!! :D
weltonwms wrote:
Thu Dec 02, 2021 1:31 pm
If you don't want to face the code, please find attached mootools-core.js with the fraig hack. Just replace that file. You can test it's success. The only modification is:

Code: Select all

old_array_from = Array.from; //this old_array_from is the native Array.from of javascript
//....
:("object" == b(a))
                ?old_array_from(a) // use of javascript's native Array.from for type "object"
//...                
download/file.php?mode=view&id=131917
mootools-core.js

tomaton
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Sat Aug 03, 2013 6:50 am
Location: Philippines

Re: GTranslate plugin don't translate recently.

Post by tomaton » Sat Aug 20, 2022 9:01 am

Hello
Thanks for introducing the GTranslate plugin, does Joomla's GTranslate use the power of Google Translate?
If there is more guidance, please explain.
Thank You


Post Reply

Return to “Extensions for Joomla! 3.x”