2 /* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3 and is published under the AGPL license. */
5 class Syj_View_Helper_LocaleSwitcher extends Zend_View_Helper_Abstract
7 public function localeSwitcher() {
8 $translator = $this->view->getHelper('translate')->getTranslator();
9 $availables = $translator->getList();
10 $current = $translator->getLocale();
12 $requestUri = $this->view->UriPath();
15 foreach ($availables as $lang) {
17 $langname = $translator->translate('english', $lang);
18 if ($lang == $current) {
19 array_push ($links, "<a class=\"other-language-anchor\">$langname</a>");
21 $href = $this->view->addParamToUrl($requestUri, 'lang', $lang, true);
22 array_push ($links, $this->view->anchor($href, $langname,
23 array('class' => 'other-language-anchor',
24 'title' => $langname, 'lang' => $lang, 'hreflang' => $lang)));
27 return "<div id=\"other-language\">" . join("", $links) . "</div>\n";