geniv/nette-locale-switch

Locale switch component for Nette Framework

v2.0.6 2018-12-17 16:34 UTC

This package is auto-updated.

Last update: 2024-12-18 05:50:07 UTC


README

Installation

$ composer require geniv/nette-locale-switch

or

"geniv/nette-locale-switch": "^2.0"

require:

"php": ">=7.0",
"nette/nette": ">=2.4",
"geniv/nette-locale": ">=2.0",
"geniv/nette-general-form": ">=1.0"

neon configure:

services:
    - LocaleSwitch

usage:

protected function createComponentLocaleSwitch(ILocaleSwitch $localeSwitch, IAliasRouter $aliasRouter): ILocaleSwitch
{
    //$localeSwitch->setTemplatePath(__DIR__ . '/templates/header-lang.latte');
    $domain = $aliasRouter->getDomainAlias();
    if ($domain) {
        $localeSwitch->setDomain($domain);
    }
    return $localeSwitch;
}

usage:

{control localeSwitch}
or
{control localeSwitch, $idLocale}