UMB-CS682-Team-02 / tracker

0 stars 1 forks source link

Charts when translated are showing the translation status information - fix by remove i18n:translate from embed tags #83

Closed rouilj closed 6 months ago

rouilj commented 6 months ago

@Pratik0116 had the answer in the standup, I just didn't understand what he was saying.

The problem is the display of the Project-Id-Version and other stuff at the bottom of the charts. Shown here in a piechart.

image

To diagnose, I added a <span class="1"></span> before each section of embeds in _generic.chart.html. I incremented 1 -> 2 ->3 for each section of embeds so I could inspect the result in the browser's devtools and identify where to look in the template.

I mentioned that that test was generated by translating nothing i.e. an empty string. Pratik mentioned that there was a i18n:translate but I didn't understand the context. Remember that i18n:translate="" is used inside a tag to translate the value between the tag (e.g. <span>) and it's close tag (</span>). I said I wasn't sure what would happen if there was nothing between the open and close tags. Well you end up translating an empty string and get the output that we are trying to get rid of.

The embed tag looked like:

<embed type="image/svg+xml" 
    tal:attributes="src python:request.indexargs_url(request.classname, 
        {'@action':request.form.getvalue('@charttype','barchart').split(',')[4]})"
   i18n:translate="" />

The embed tag is a void element that doesn't have any content and doesn't use/need an end tag like </embed>. So the translator gets an empty string and the hilarity above ensues.

To fix: remove the i18n:translate attribute and value from the embed tags. The translation of the charts is done at the python extension level not the tal level.

ashrith-UMB commented 6 months ago

Removed i18n:translate property from embed tags in _generic.chart.html which was displaying the translate data. commit : https://github.com/UMB-CS682-Team-02/tracker/commit/143a043ac168d7ffbae1029f33b9861d8ec8addc

rouilj commented 6 months ago

LGTM