• Resolved Nikodemsky

    (@nikodemsky)


    So the:
    LANGUAGE AUTO-DETECTION STRATEGY: Document
    doesn’t work properly, no matter what language is used in <html lang=””> it shows content always in english.

    Maybe the issue is that it looks for simplfied codes like:
    de
    instead of iso codes:
    de-DE
    ?

    Tried it both with WPML and Polylang – it’s broken on both of those.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author pressidium

    (@pressidium)

    Hey, @nikodemsky!

    Maybe the issue is that it looks for simplfied codes like:
    de
    instead of iso codes:
    de-DE
    ?

    Within the plugin’s UI, you’ll find different language options. Opting for German will attempt to detect de, while German (Germany) will try to detect de-DE, German (Austria) will result in de-AT, and so forth.

    Double-check that the languages you’ve selected are consistent with the settings of your translation plugin, such as WPML, Polylang, or similar plugins.

    If this doesn’t resolve your issue, please let us know and provide a link to a website where the problem can be reproduced, if it’s possible.

    Thread Starter Nikodemsky

    (@nikodemsky)

    Ok so that explains a lot, it’s kind of confusing tho imo – any chance that you can add iso codes like [de] or [de-DE] before language name in dropdown?

    Plugin Author pressidium

    (@pressidium)

    Thanks for following up! It’s good to know that everything is working as expected.

    it’s kind of confusing tho imo – any chance that you can add iso codes like [de] or [de-DE] before language name in dropdown?

    Yeah, we’ll definitely look into making things clearer to prevent confusion in the future.

    I’m going to mark this as resolved. If you come across any other issues, feel free to create a new topic or open an issue on GitHub.

    Hi,
    I came across the same issue. But there is no Polish (Polish) to choose from the list so it always looks for “pl” instead of pl_PL (Polylang)

    Plugin Author pressidium

    (@pressidium)

    Hey, @smartjb!

    This is already on our radar. We’re tracking its progress in #61 on the plugin’s GitHub repository.

    We’ll refine the options available within the language select field in a future iteration of the plugin.

    Thanks for your understanding and patience.

    Just use FILTER to modify LANG attribute OUTPUT

    function modify_language_attributes_defaults($output, $doctype) {
    
    ? ? // Check if WPML is active
    ? ? if (function_exists('icl_object_id')) {
    
    ? ? ? ? // Get the current language code
    
    ? ? ? ? ?$current_language = apply_filters('wpml_current_language', NULL);
    
    ? ? ? ? switch ($current_language) {
    
    ? ? ? ? ? ? case 'en':
    
    ? ? ? ? ? ? ? ? $output = str_replace('en-US', 'en', $output);
    
    ? ? ? ? ? ? ? ? break;
    
    ? ? ? ? ? ? case 'lt':
    
    ? ? ? ? ? ? ? ? $output = str_replace('lt-LT', 'lt', $output);
    
    ? ? ? ? ? ? ? ? break;
    
    ? ? ? ? ? ? case 'ru':
    
    ? ? ? ? ? ? ? ? $output = str_replace('ru-RU', 'ru', $output);
    
    ? ? ? ? ? ? ? ? ?break;
    
    ? ? ? ? ?}
    
    ? ? }
    
    ? ? return $output;
    }
    
    // add the filter
    add_filter( "language_attributes", "modify_language_attributes_defaults", 10, 2 );
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Language detection’ is closed to new replies.