On 01/07, carstene1ns wrote:
Am 28.06.2015 um 21:22 schrieb Johannes Löthberg:Note that since we have to do it through JS we have to use strings like "1 package(s) selected" instead of properly gettext'ed ones.What about using the translated string with a placeholder from JS and replace it? Then use an empty <span> element here:diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index cce533c..b40c87d 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -9,6 +9,8 @@ if (!$result): ?> <p> <?= _n('%d package found.', '%d packages found.', $total) ?> <?= __('Page %d of %d.', $current, $pages) ?> + <?= __('%s%s%s package(s) selected.', + '<span id="pkglist-checked-count">', '0', '</span>') ?> </p> <?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav">and here:@@ -89,6 +91,8 @@ if (!$result): ?> <p> <?= _n('%d package found.', '%d packages found.', $total) ?> <?= __('Page %d of %d.', $current, $pages) ?> + <?= __('%s%s%s package(s) selected.', + '<span id="pkglist-checked-count">', '0', '</span>') ?> </p> <?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav">var str = <?= __('%NUMBER% package(s) selected.) ?> var res = str.replace("%NUMBER%", count.toStr()); $("%pkglist-checked-count").text(res); (code is untested) This approach has the benefit that users without activated javascript do not see the string at all instead of it not changing, which is a better user experience.
That is a good idea, thanks. -- Sincerely, Johannes Löthberg PGP Key ID: 0x50FB9B273A9D0BB5 https://theos.kyriasis.com/~kyrias/
signature.asc
Description: PGP signature
