I have been wracking my brain trying to get Babel to work with a English & French setup. I have followed the instructions I found in a few posts so my settings are:
Contexts
web
cultureKey: en
base_url: /
site_start: 1
site_url: {url_scheme}{http_host}{base_url}{cultureKey}/
fr
cultureKey: fr
base_url: /
site_start: 2
site_url: {url_scheme}{http_host}{base_url}{cultureKey}/
Access permissions for both contexts anonyous users are Load, List, and View
I then installed Babel and LangRouter.
My htaccess is:
RewriteEngine On
RewriteBase /
The Friendly URLs part
detect language when requesting the root (/)
RewriteCond %{HTTP:Accept-Language} !^en [NC]
RewriteRule ^$ en/ [R=301,L]
RewriteRule ^$ fr/ [R=301,L]
redirect all requests to /en/favicon.ico and /de/favicon.ico
to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr)/favicon.ico$ favicon.ico [L,QSA]
redirect all requests to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr)/assets(.*)$ assets$2 [L,QSA]
redirect all other requests to cultureKey
to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|fr)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
I created a resource in English and then a tranlated doc of that in French. My template is:
[[*pagetitle]]
[[*content]] [[BabelLinks?]]
So this setup doesn’t work and I am not sure why.
However, if I add the key to the base_url setting, ie:
web
base_url: /en/
fr
base_url: /fr/
then it works! But the url is not correct. It comes out as http://domain.com/en/en/ for web and http://domain.com/fr/fr/
Can anybody provide some insight on this?
Thanks in advance.