• Resolved Mykyta Synelnikov

    (@nsinelnikov)


    Hi Weglot team,

    Thanks for your great plugin. I really love this UX that you provided!
    My name is Nikita and I’m a lead developer in the Ultimate Member plugin team.

    Currenty, we are working on the multilingual integrations for our plugin based on WordPress native get_locale() and get_user_locale() functions.

    Is it possible to add the WP native locale keys to your Languages Data array?
    e.g. ‘en’ => ‘en_US’, ‘ru’ => ‘ru_RU’, ‘uk’ => ‘uk’, etc.

    I have this Gist also https://gist.github.com/nikitasinelnikov/83e3d3e201093ed0566b595285cedb28

    Let me know,
    Best Regards!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hello,

    glad you like the plugin.
    Regarding your request, after having discussed with the teams, we have no plans to add this language format in the near future. We do not rule out doing so in the future, however.

    in your case you can use the following filter:

    // Use zh-HK (Hong Kong Chinese) instead tw (Traditional Chinese)
    add_filter( 'weglot_language_code_replace', 'custom_weglot_language_code_replace' );
    function custom_weglot_language_code_replace( $replacements ) { 
        $replacements['tw'] = 'zh-HK';
        return $replacements;
    }

    you can update this code with your own language code

    Hope it help you
    Don’t hesitate if you have any question

    Regards

    Thread Starter Mykyta Synelnikov

    (@nsinelnikov)

    Hi @glx77

    Thanks for your response! I saw this code snippet that you have attached in reply.

    It can certainly help, but I am not an end-user with a limited number of languages. I am trying to do an integration. In order for it to be identical in different situations and with different multilingual plugins, it would be great to have the language key association that WordPress offers with your keys within your own list.

    I do not need a complete replacement of the key, but only get the current locale in WP native format.

    Maybe is it possible to make a Pull Request as a third-party developer?

    Please see what I mean to avoid the confusing https://gist.github.com/nikitasinelnikov/42cc8e2d7d6247544e11913925b50ede#file-languages-php-L6

    Let me know your thoughts,
    Best Regards!

    Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hi @nsinelnikov, thanks for you reply.
    I understand what you but if we put the language code from wordpress you have to make some code to get the value.

    so why not do this:
    
    1- integrate the correspondence table on your side
    2- use the weglot_get_current_language function to have the current language of weglot
    3- retrieve the code corresponding to wordpress via your correspondence table

    regards

    Dear friends, is any of you available to do a small custom work for this JobBoardWP plugin?. All I need is to add some additional fields to the job submission form. I read the documentation to overrride the templates, but I could not successfully do the changes. Please let me know. Thanks. Contact email: [email protected]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add WordPress native locales’ keys’ is closed to new replies.