From 269a9d46938e0b4d178642ae8315602f9e5f3349 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 18 Jan 2008 01:06:31 +0100 Subject: [PATCH] Fix l10n support for javascript generated text The text contained hardcoded English string (which was concealed by the fact that Javascript was broken anyway and so the text was never displayed). Now that I fixed the Javascript, fix the l10n support, too. --- static/packages.js | 13 +++++++------ templates/html/search.tmpl | 2 +- templates/html/show.tmpl | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/static/packages.js b/static/packages.js index 1de28bc..172e6b4 100644 --- a/static/packages.js +++ b/static/packages.js @@ -1,13 +1,14 @@ -function init_toggle_elem(id_str,user_str) { - toggle_toggle_elem(id_str,user_str,'hide'); +function init_toggle_elem(id_str,show_user_str,hide_user_str) { + toggle_toggle_elem(id_str,show_user_str,hide_user_str,'hide'); } -function toggle_toggle_elem(id_str,user_str,mode) { +function toggle_toggle_elem(id_str,show_user_str,hide_user_str,mode) { var other_mode = ( mode == "hide" ) ? "show" : "hide"; + var user_str = ( mode == "hide" ) ? show_user_str : hide_user_str; var link = document.createElement("a"); - link.setAttribute("href","javascript:toggle_toggle_elem(\""+id_str+"\",\""+user_str+"\",\""+other_mode+"\")"); - var txt = document.createTextNode("["+other_mode+" "+user_str+"]"); + link.setAttribute("href","javascript:toggle_toggle_elem(\""+id_str+"\",\""+show_user_str+"\",\""+hide_user_str+"\",\""+other_mode+"\")"); + var txt = document.createTextNode("["+user_str+"]"); link.appendChild(txt); if (document.getElementById("js_"+id_str).childNodes.length > 0) { document.getElementById("js_"+id_str).replaceChild(link,document.getElementById("js_"+id_str).firstChild); @@ -146,4 +147,4 @@ function show_all_tabs() { if (item) { item.style.fontWeight = "bold"; } -} \ No newline at end of file +} diff --git a/templates/html/search.tmpl b/templates/html/search.tmpl index 2cf2aeb..52e8c30 100644 --- a/templates/html/search.tmpl +++ b/templates/html/search.tmpl @@ -112,7 +112,7 @@ [%- IF real_archive %] [[% real_archive %]][% END %]
[% g('Binary packages:') %] [% FOREACH binary IN binaries.sort %][% binary %][% ', ' UNLESS loop.last %][% END %] [% IF binaries.size > 10 %] - + [% END %] [% END %] diff --git a/templates/html/show.tmpl b/templates/html/show.tmpl index 9ab8f48..5389798 100644 --- a/templates/html/show.tmpl +++ b/templates/html/show.tmpl @@ -256,7 +256,7 @@ [% js_id = name %] [% FOREACH provider IN providers.pkgs.sort %][% provider %][% ', ' UNLESS loop.last %][% END %] [% IF providers.pkgs.size > 10 %] - + [% END %] [% END %] -- 2.39.2