qtranslate-xt
qtranslate-xt copied to clipboard
Wrong HTML lang
I setup lang code ru-EE pic: https://bit.ly/3fhvTSM
But the site frontend is nowhere - ru-EE Backend is ok . All language translation files is work fine with ru_EE.
But frontend Lang code show: ru-RU pic: https://bit.ly/3uidqcX
Only with ru-RU problem.
For example if i setup en-EE when all is ok. Frontend en-EE too .
It looks like an unfinished concept to me!
if your theme uses the function "language_attributes()" you could use the corresponding filter.
add_filter('language_attributes', function ($output, $doctype) {
if (function_exists('qtranxf_getLanguage')) {
global $q_config;
$locale = $q_config[ 'locale_html' ][ qtranxf_getLanguage() ] ?? '';
if (! empty($locale)) {
$output = 'lang="'. $locale .'"';
}
}
return $output;
}, 10, 2);
It works ! Thank you.
But why qtranslate dont have this most important funciton inside ? Please add this. or optionaly.
Interesting fact
-
At localhost HTML lang="ru-RU" work without this function
-
At server HTML lang="ru-RU" dont work without this function.
A similar question was asked in the past.
Normally, the locale (front-end) for the HTML lang attribute should be used with priority, if this was defined via the administration (locale at front-end) - but this is currently not the case!
The reason why the locale for Russian (Estonia) is still not used can be found in the source code ... as I'm not a fan of Trial & Error, I don't want to go into this any further.
Right, but you already raised that issue some time ago, see #974. I keep this one as there's more information.
I'm aware there is something wrong with the locales, that was one of the reasons not finishing #668. I've been busy on other things but we will come back to this.
At least he now has the opportunity to help himself with a possibly urgent project in the short term.