Returns supported locales
public getSupportedLocales ( ) : array | ||
return | array |
/** * Renders the language selector * @return string */ public function render() { /** @var string $currentLocale */ $currentLocale = $this->gettext->getLocale(); $html = '<ul class="language-selector">'; foreach ($this->gettext->getSupportedLocales() as $locale) { $localeLabel = $locale; // Check if label exists if (array_key_exists($locale, $this->labels)) { $localeLabel = $this->labels[$locale]; } $link = '<a href="/lang/' . $locale . '" class="' . $locale . '">' . $localeLabel . '</a>'; if ($locale == $currentLocale) { $link = '<strong class="active ' . $locale . '">' . $localeLabel . '</strong>'; } $html .= '<li>' . $link . '</li>'; } $html .= '</ul>'; return $html; }