marceloschmitt / moodle-block_analytics_graphs

Learning analytics Moodle plugin - graphs to help teachers.
GNU General Public License v3.0
15 stars 17 forks source link

French translation having simple quote make it crash #46

Open MathieuDomingo opened 3 years ago

MathieuDomingo commented 3 years ago

Hello,

in file graphresourceurl.php (I haven't checked others files) you directly use strings like this one for example : name: '<?php echo get_string('no_access', 'block_analytics_graphs'); ?>',

The French translation of this string is " Pas d'accès" : their is a quote in it which directly close the first quote and then generate a malformed file.

I think you should always use the addslashes function to resolve this problem, for example : name: '<?php echo addslashes(get_string('no_access', 'block_analytics_graphs')); ?>',

Have a good day, Mathieu

luiggisanso commented 1 year ago

Hi @marceloschmitt

Blank page is still here, but in french we can translate by : "Aucun accès"

I'll update the french packtage

But @MathieuDomingo suggestion is really better.

marceloschmitt commented 1 year ago

Sorry. Can you send me French translation. I will add to the corrected version. And I can use to see the problem.

luiggisanso commented 1 year ago

Hi @marceloschmitt

French translation (and other language pack) is directly in AMOS (https://lang.moodle.org/). So you have nothing to do ;-)

MathieuDomingo commented 2 months ago

Hello,

another bug involving apostrophes : when the course title contains an apostrophe (for example : Introduction à l'algo ), the graph checking access crash because the file generated is malformed

To correct it, it's the same solution at suggested in my first message, in file graphresourceurl.php add calls to function addslashes, for this one it's in the block of lines 267 272. Before :

                    subtitle: {
                        text: ' <?php echo get_string('course', 'block_analytics_graphs') . ": "
                                        . $courseparams->fullname . "<br>".
                                        get_string('begin_date', 'block_analytics_graphs') . ": "
                                        . userdate($startdate); ?>'
                    },

After :

                    subtitle: {
                        text: ' <?php echo addslashes(get_string('course', 'block_analytics_graphs') . ": "
                                        . $courseparams->fullname . "<br>".
                                        get_string('begin_date', 'block_analytics_graphs') . ": "
                                        . userdate($startdate)); ?>'
                    },

Have a good day, Mathieu

marceloschmitt commented 1 month ago

Mathie, gonna fix it today.

Marcelo Augusto Rauh Schmitt @.***

Em 17 de set de 2024, à(s) 11:06, MathieuDomingo @.***> escreveu:

Hello,

another bug involving apostrophes : when the course title contains an apostrophe (for example : Introduction à l'algo ), the graph checking access crash because the file generated is malformed

To correct it, it's the same solution at suggested in my first message, in file graphresourceurl.php add calls to function addslashes, for this one it's in the block of lines 267 272. Before :

                subtitle: {
                    text: ' <?php echo get_string('course', 'block_analytics_graphs') . ": "
                                    . $courseparams->fullname . "<br>".
                                    get_string('begin_date', 'block_analytics_graphs') . ": "
                                    . userdate($startdate); ?>'
                },

After :

                subtitle: {
                    text: ' <?php echo addslashes(get_string('course', 'block_analytics_graphs') . ": "
                                    . $courseparams->fullname . "<br>".
                                    get_string('begin_date', 'block_analytics_graphs') . ": "
                                    . userdate($startdate)); ?>'
                },

Have a good day, Mathieu

— Reply to this email directly, view it on GitHub https://github.com/marceloschmitt/moodle-block_analytics_graphs/issues/46#issuecomment-2355937293, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGPGZ4327AQYWC7L7PSXRDZXAZP3AVCNFSM6AAAAABOLSBKEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJVHEZTOMRZGM. You are receiving this because you were mentioned.