I am trying to add a multilingual system to my site. but when I try to visit the “bn” URL it redirects to the home URL.
Site URL: http://modx.maisto-design.de/
I have tried XRouting and custom plugins as well but none is working.
you can recommend one of them and write the .haccess file as needed.
Thanks in advance
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'bn':
/* switch the context */
$modx->switchContext('bn');
break;
default:
/* Set the default context here */
$modx->switchContext('web');
break;
}
/* unset GET var to avoid
* appending cultureKey=xy to URLs by other components */
unset($_GET['cultureKey']);
}
How can I add/display a form with multiple languages?
I kept the fields label and placeholder static.
Should I make them dynamic to translate the text?
Besides, how can I validate each field with translated error text/message
how do validate email and phone fields with a pattern?
and how to require email or phone, both are not required but one is.