e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
322 stars 214 forks source link

Problem with en.js and nl.js of the plupload plugin #4888

Open Alex-e107nl opened 2 years ago

Alex-e107nl commented 2 years ago

Bug Description

Uncaught ReferenceError: plupload is not defined https://fysiotransparant.nl/e107_web/js/plupload/i18n/nl.js:2 In e107_admin

How to Reproduce

Use the dutch translation and inspect the code of the control panel

Expected Behavior

No error... should not be loaded?

In the Dutch translation we use nl.js in e107_web/js/plupload/i18n to translate the plupload in the mediamanager, but it gets loaded on every admin page and gives a error.. Uncaught ReferenceError: plupload is not defined https://fysiotransparant.nl/e107_web/js/plupload/i18n/nl.js:2 - But when i delete the file there's no english en.js loaded... so why ....

Translation works by the way :-)

CaMer0n commented 2 years ago

So is this happening now after the plupload upgrade?

Alex-e107nl commented 2 years ago

Yep it's still happening, when i am in Dutch language ->e107_admin/admin.php ->

Uncaught ReferenceError: plupload is not defined
    <anonymous> https://e107.nl/e107_web/js/plupload/i18n/nl.js:2
nl.js:2:1

The dutch translation works and is:

// Dutch (nl)
plupload.addI18n(
{
"Stop Upload":"Stop Upload","Upload URL might be wrong or doesn't exist.":"Upload URL is verkeerd of bestaat niet.",
"tb":"tb",
"Size":"Grootte",
"Close":"Sluiten","You must specify either browse_button or drop_element.":"Specificeer ofwel de browse_button ofwel het drop_element.",
"Init error.":"Initialisatie error.",
"Add files to the upload queue and click the start button.":"Voeg bestanden toe aan de wachtrij en druk op 'Start'.",
"List":"Lijst",
"Filename":"Bestandsnaam",
"%s specified, but cannot be found.":"%s ingegeven maar kan niet gevonden worden.",
"Image format either wrong or not supported.":"Bestandsextensie is verkeerd of niet ondersteund.",
"Status":"Status",
"HTTP Error.":"HTTP Error.",
"Start Upload":"Start Upload",
"Error: File too large:":"Error: bestand te groot:",
"kb":"kb",
"Duplicate file error.":"Fout, bestand bestaat al.",
"File size error.":"Bestandsgrootte fout.",
"N/A":"Niet beschikbaar",
"gb":"gb",
"Error: Invalid file extension:":"Fout: Ongeldige bestandsextensie:",
"Select files":"Selecteer bestand(en):",
"%s already present in the queue.":"%s is al aan de wachtrij toegevoegd.",
"Resolution out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.":"Resolutie buiten de grenzen! <b>%s</b> runtime ondersteunt alleen afbeeldingen tot %wx%hpx.",
"File: %s":"Bestand: %s",
"b":"b",
"Uploaded %d/%d files":"%d/%d bestanden ge-upload",
"Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Upload accepteert alleen %d bestand(en) tegelijk. Extra bestanden zijn verwijderd.",
"%d files queued":"%d bestand(en) in de wachtrij",
"File: %s, size: %d, max file size: %d":"Bestand: %s, grootte: %d, maximale bestandsgrootte: %d",
"Thumbnails":"Thumbnails",
"Drag files here.":"Sleep bestanden hierheen.",
"Runtime ran out of available memory.":"Het maximum bruikbare geheugen is overschreden.",
"File count error.":"Teveel bestand(en) fout.",
"File extension error.":"Ongeldig bestandsextensie.",
"mb":"mb",
"Add Files":"Bestand(en) toevoegen"
}
);

But on e107_admin/image.php it does not give the warning.

Used the latest git!

tgtje commented 1 year ago

@CaMer0n @Alex-e107nl just found a probabel solution... before commiting or changing 'our (nl)' language file i did a read through tiny / mce issues.. (got the error while working on vstore checks)

It looks like some changes were made (tiny api) and had these : the reference (in short) would relate to the use of the (let's call it) locale > (old deprecated) > NEW api call > tinymce.addI18n(languageCode, data) so when testing this aka rename the nl js to nl_NL js the error is gone.. Iff this is true this would be a needed change (translations) for all except en (so it seems). May i have some confirmation ?

edit : my error : Uncaught ReferenceError: plupload is not defined 2.3.3 php 8.1.0

Alex-e107nl commented 11 months ago

@CaMer0n @tgtje Well the problem is that on every page in the admin there's a <script src="[/demo08/e107_web/js/plupload/i18n/nl.js](view-source:https://fysiowebdesign.nl/demo08/e107_web/js/plupload/i18n/nl.js)"></script> and when the plupupload is used with:

<script src="[/demo08/e107_web/js/plupload/plupload.full.min.js](view-source:https://fysiowebdesign.nl/demo08/e107_web/js/plupload/plupload.full.min.js)"></script>
<script src="[/demo08/e107_web/js/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js](view-source:https://fysiowebdesign.nl/demo08/e107_web/js/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js)"></script>

on page /e107_admin/image.php?mode=main&action=dialog&for=page^&tagid=menu-image&iframe=1&w=206&image=1&youtube=1&video=1 the problem with the Uncaught ReferenceError: plupload is not defined is not there so the nl.js is loaded in the wrong place....

Alex-e107nl commented 11 months ago

@CaMer0n @tgtje

The solution is to:

  1. In e107_admin/header.php delete:
    $plUpload = 'plupload/i18n/' . e_LAN . '.js';
    if(e_LAN != 'en' && file_exists(e_WEB_JS . $plUpload))
    {
        e107::js('footer', e_WEB_JS . $plUpload, 'jquery', 5);
    }
  2. In e107_admin/image.php add:
    $plUpload = 'plupload/i18n/' . e_LAN . '.js';
    if(e_LAN != 'en' && file_exists(e_WEB_JS . $plUpload))
    {
        e107::js('footer', e_WEB_JS . $plUpload, 'jquery', 5);
    }

Can this be done? Tested and confirmed translation is perfect and the Uncaught ReferenceError is gone!

Reference: https://www.plupload.com/docs/v2/Plupload-in-Your-Language To activate the language pack you simply need to include the corresponding js file after the Plupload scripts...