You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pleinx edited this page May 24, 2017
·
10 revisions
#TODO #INPROGRESS
SlimFramework v2+
Add to your dependencies.php
$container['translator'] = function ($c) {
$settings = (new MultilangAny\Settings())
->setIsProduction(true)
->setLanguageFilesPath(__DIR__ .'/../lang/');
return new MultilangAny\TranslatorAPI($settings);
};
Htaccess
Add to your .htaccess
RewriteEngine On
# In some cases you have to add your path
RewriteBase /
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ https://yourwebsite.domain/en/ [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ https://yourwebsite.domain/de/ [L,R=301]
# ?lang=$1 or your configured paramter in the Translator Config
RewriteRule ^(en|de)/(.*)$ $2index.php?lang=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]