Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong HTML lang #1030

Open
andreysneg opened this issue May 24, 2021 · 5 comments
Open

Wrong HTML lang #1030

andreysneg opened this issue May 24, 2021 · 5 comments
Labels
core Core functionalities, including the admin section

Comments

@andreysneg
Copy link

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 .

@MK-RD
Copy link

MK-RD commented May 24, 2021

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);

@andreysneg
Copy link
Author

andreysneg commented May 27, 2021

It works ! Thank you.

But why qtranslate dont have this most important funciton inside ? Please add this. or optionaly.

Interesting fact

  1. At localhost HTML lang="ru-RU" work without this function

  2. At server HTML lang="ru-RU" dont work without this function.

@MK-RD
Copy link

MK-RD commented May 27, 2021

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.

@herrvigg herrvigg added the duplicate This issue or pull request already exists label May 29, 2021
@herrvigg
Copy link
Collaborator

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.

@MK-RD
Copy link

MK-RD commented May 29, 2021

At least he now has the opportunity to help himself with a possibly urgent project in the short term.

@herrvigg herrvigg added core Core functionalities, including the admin section and removed duplicate This issue or pull request already exists labels Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionalities, including the admin section
Projects
None yet
Development

No branches or pull requests

3 participants