Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

In *stores.php* we have locales like this: Here in this array, key 'en' and 'de', what does it re

Options
U035GSLDLVD
U035GSLDLVD Posts: 90 🧑🏻‍🚀 - Cadet

In stores.php we have locales like this: Here in this array, key 'en' and 'de', what does it represent?

'locales' => [
            // first entry is default
            'en' => 'en_US',
            'de' => 'de_DE',
        ],

Is it used for country? or we can add anything as key and key is not used anywhere? I have 5+ locales available for multiple countries like fr_CA, en_CA and es_CA.

Comments

  • U03H06V0LAY
    U03H06V0LAY Posts: 39 🧑🏻‍🚀 - Cadet
    edited October 2022
    Options

    This is default language used for API, not sure how its effected by you adding further locales as i have not tried, but the first locale in array is the default. So if ‘de_DE’ was moved to the first position it would make your default responses from Glue API return in German

  • U035GSLDLVD
    U035GSLDLVD Posts: 90 🧑🏻‍🚀 - Cadet
    edited October 2022
    Options

    ok. Thanks @U03H06V0LAY

    if I have three locales like en_US, en_GB and en_AU, I can not keep the same en key right?

  • U03H06V0LAY
    U03H06V0LAY Posts: 39 🧑🏻‍🚀 - Cadet
    Options

    no, i’d imagine the key must be unique, so using the postfix of ‘GB’ or ‘AU’ might be the way to go in that scenario

  • U035GSLDLVD
    U035GSLDLVD Posts: 90 🧑🏻‍🚀 - Cadet
    Options

    ok. Thanks @U03H06V0LAY It means i have to keep unique key regardless of multiple locale in one county. in glue that key will be used to return particular locale value?

  • U03H06V0LAY
    U03H06V0LAY Posts: 39 🧑🏻‍🚀 - Cadet
    Options

    the key will be used to determine the language used in the Glue response

  • U035GSLDLVD
    U035GSLDLVD Posts: 90 🧑🏻‍🚀 - Cadet
    Options

    Ok @U03H06V0LAY Thanks for the help!