Simple quotes on translations and javascript

Author Message

Sergi A

Thursday 29 April 2010 1:09:56 am

Hi!

i'm using ezmultiupload extension and I have a little problem with this tpl:

extension/ezmultiupload/design/standard/templates/ezmultiupload/upload.tpl

the code where some javascript string variables are being set, there is a TPL code that uses the i18n operator and assigns the returned string to a variable (lines 37-50).

YAHOO.ez.MultiUpload.cfg = {ldelim} 
                              swfURL:'{'javascript/yui/2.7.0/build/uploader/assets/uploader.swf'|ezdesign( 'no' )}', 
                              uploadURL: '{concat( 'ezmultiupload/upload/', $parent_node. node_id )|ezurl( 'no' )}', 
                              uploadVars: {ldelim}  
                                              '{$session_name}': '{$session_id}', 
                                              'UserSessionHash': '{$user_session_hash}', 
                                              'UploadButton': 'Upload' 
                                          {rdelim}, 
                              fileType: '{$file_types}', 
                              progressBarWidth: '300', 
                              allFilesRecived: '{'All files received.'|i18n('extension/ezmultiupload')}', 
                              uploadCanceled: '{'Upload canceled.'|i18n('extension/ezmultiupload')}', 
                              thumbnailCreated: '{'Thumbnail created.'|i18n('extension/ezmultiupload')}' 
                           {rdelim};

The problem is that Catalan language has the ' character and it appears in these translations, so it breaks the javascript string leading to a malfunction.

The solution would be a tpl operator that replaces the ' character with '' (double simple quote) so that it doesn't interferes with the js string. But i can't find this operator...

did anybody find this problem?

Sergi.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 29 2025 23:52:09
Script start
Timing: Jan 29 2025 23:52:09
Module start 'layout'
Timing: Jan 29 2025 23:52:09
Module start 'content'
Timing: Jan 29 2025 23:52:10
Module end 'content'
Timing: Jan 29 2025 23:52:10
Script end

Main resources:

Total runtime0.6621 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 588.2656151.2266
Module start 'layout' 0.00620.0024 739.492236.6797
Module start 'content' 0.00860.6526 776.1719377.5938
Module end 'content' 0.66120.0008 1,153.76567.8125
Script end 0.6620  1,161.5781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4559160.0002
Check MTime0.00130.1981160.0001
Mysql Total
Database connection0.00070.109210.0007
Mysqli_queries0.633895.7370460.0138
Looping result0.00030.0404440.0000
Template Total0.635395.920.3176
Template load0.00180.276520.0009
Template processing0.633495.671720.3167
Template load and register function0.00010.017810.0001
states
state_id_array0.00160.239610.0016
state_identifier_array0.00050.080920.0003
Override
Cache load0.00140.2128120.0001
Sytem overhead
Fetch class attribute can translate value0.00040.057110.0004
Fetch class attribute name0.00040.063310.0004
XML
Image XML parsing0.00010.013310.0001
class_abstraction
Instantiating content class attribute0.00000.000610.0000
General
dbfile0.00090.1323100.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 6
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs