Here the correction :
createAmetysCalendar.createHTML4Legend = function(id, categories) { if (categories.length > 0) { var html = ""; html += "<div class='legend'>"; html += "<ul>"; html += "<li class='all'>"; html += "<a href=\"javascript:createAmetysCalendar.changeCategory('" + id + "', 'all');\">{{i18n CALENDAR_SERVICE_AGENDA_ALL_EVENTS}}</a>"; html += "</li>"; for (var i = 0; i < categories.length; i++) { html += "<li class='category_" + categories[i].num + " category_" + categories[i].name + "'>"; html += "<a href=\"javascript:createAmetysCalendar.changeCategory('" + id + "', '" + categories[i].name + "');\">" + categories[i].label + "</a>"; html += "</li>"; } html += "</ul>"; html += "</div>"; return html; } else { return ""; } }