Previously, for multilingual support, I simply used BABEL and a plugin that switched contexts based on the cultureKey
I added the following to .htaccess
# Redirects le chiamate di /en/favicon a quella favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(it|en|es|de|fr)/favicon.ico$ favicon.ico [L,QSA]
# Come sopra per gli assets da /en/assets/ a assets/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(it|en|es|de|fr)/assets(.*)$ assets$2 [L,QSA]
# Redirects tutte le altre richieste da /en/ a normale cambiando la culturkey
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(it|en|es|de|fr)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
I would apply for every context other than web, English (German)
cultureKey en (de)
base_url {base_url}en/ ({base_url}de/)
site_url {site_url}en/ ({site_url}de/)
site_start 1 (69)
in the head I inserted
<base href="[[!++site_url]]" />
...
<link rel="image_src" href="[[!++site_url]]default.jpg" />
...
<link rel="stylesheet" href="[[!++site_url]]assets/css/style.css" />
...
<script src="[[!++site_url]]assets/js/script.js?v=04042023"></script>
If I inserted a TV image into the template, I would retrieve it with [[*imgTv]] by including it as the src (relative path) and I would insert all other relative paths (e.g., assets/…).
Everything was working; the only problem was with images in tinyMCE RTE that didn’t work on pages in contexts other than web (I was using TVs).
I tried to evolve and looked for other solutions. The information on Babel and various routing options is not very explanatory, and the old links I had on Babel, which explained with examples and snippets, redirect to the general page.
I decided to always use Babel but to evolve towards smartRouting, and I couldn’t get anything to work. ![]()
My settings are what I have read and the following
But on the pages outside the web context, CSS and JS are not loaded, images (*imgTv) with a relative path neither)
Whether I include the initial .htaccess lines or omit them.
Is there any kind soul who can explain to me, even with examples, in detail what settings to configure to make Babel work with smartRouting?
Creating a multilingual (multicontext) site with Babel and smartRouting shouldn’t be that difficult, so perhaps providing a detailed example would help many, maybe even to be included in the explanations in MODX Docs.
thanks in advance
