mapseed/platform

Enable translations (via Django template tags) on #side-bar divs

Closed this issue · 4 comments

Currently when we prefix a string with {#_} and append it with {/_} in the base.html file, the translations are not completed. Same is true for the String literal tags inside legend-view.js on the divs under #side-bar (ie #master-legend, #toggle-layers and #ticker). How do we allow the template tags to be applied to these html divs?

Hey Andy, can you help us out with this issue? It is related to the templating issue that you mentioned earlier, and I think it can be resolved by avoiding String literals in our Javascript. Feel free to get in touch if I can clarify anything.

Yes this looks like something I can help with. I'll take a look tonight after rehearsal.

Great! Just for clarity, you can find the String literals in legend-view.js on lines 15, 17, 24-44, and 49-65.

We are trying to enable the Django localization (translation) machinery, which should work, for example, by replacing line 24 in legend-view.js:

var $markup = '<p>Toggle layers:</p><ul class="layer-type-list unstyled-list">',

with this:

var $markup = '<p>{{#_}}Toggle layers:{{/_}}</p><ul class="layer-type-list unstyled-list">',

but it doesn't work on our String literals nor with our html in base.html ie we would replace line 124:

 <p>Recent report activity</p>

with this:

 <p>{{#_}}Recent report activity{{/_}}</p>

If we use the right templating system, I think we can enable this feature using the {{#_}} {{/_}} tags or using our own variables from our config.yml, where we mark variables for translation using _( and ). For example, line 69 is title: _(Historical Flow), where the "title" is later translated to the Spanish equivalent Sendero Historico.

Either way, removing these string literals would be a great help :-)

Thanks again, and let me know if you have questions

If we can resolve #136, then this issue will be resolved as well. I will close this issue so that we can focus on #136 instead.