• Resolved pixxelstudio86

    (@pixxelstudio86)


    Hi
    I want to display languages in a custom order. My site includes a total of 9 languages, with English being the main language. I am currently using the shortcode to show the languages in the navigation menu as a click to popup. Currently languages are showing in chronological order or i’m not sure which order.

    The desired order of languages is:

    1. Spanish
    2. English
    3. Arabic
    4. Nederlandse
    5. French
    6. German
    7. Chinese
    8. Russian
    9. Turkish

    I’ve tried the following approach using JavaScript to reorder the languages, but it didn’t work:

    document.addEventListener('DOMContentLoaded', function() {
    var languages = [
    { code: 'es', name: 'Espa?ol' },
    { code: 'en', name: 'English' },
    { code: 'ar', name: '???????' },
    { code: 'nl', name: 'Nederlands' },
    { code: 'fr', name: 'Fran?ais' },
    { code: 'de', name: 'Deutsch' },
    { code: 'zh-CN', name: '简体中文' },
    { code: 'ru', name: 'Русский' },
    { code: 'tr', name: 'Türk?e' }
    ];

    var languageSelector = document.querySelector('.gtranslate_wrapper select');
    console.log('Language Selector:', languageSelector); // Debugging line

    if (languageSelector) {
    languageSelector.innerHTML = '';
    languages.forEach(function(language) {
    var option = document.createElement('option');
    option.value = language.code;
    option.textContent = language.name;
    languageSelector.appendChild(option);
    });
    } else {
    console.log('Language selector not found.');
    }
    });

    Could you please assist me in configuring the languages to display in the custom order mentioned above? Any guidance or suggestions would be greatly appreciated.

    Thanks so much!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Language Order’ is closed to new replies.