Difference between language files and how to set them

Hi @thomasmalbaux , I have 3 other questions with regards to locales files.

  1. In the locales files, there are 2 Spanish ones: es.yml and es-es.yml. What is the difference? Which is the one for Spanish?

  2. If we want to add another language to our site (based on an existing yml file), which file do we modify and how?

  3. If we want to change the order of languages for our site (in the language drop-down menu), which file do we use and how?

Thanks!

-Duc

Hey there Duc!

Here are answers to your questions.

1 -
es is a south-american version of Spanish, and es-ES is for Spanish from Spain. As you can imagine, there are quite a few variations between both regions. In the available_locales.rb file you can always refer to the region, name or comment to learn more.

2 -
If it isn’t there already, you should define the language in the SUPPORTED_LOCALES section of the available_locales file and deploy your changes. After the language is added to the SUPPORTED_LOCALES list and the server is restarted, the new language will be available in the “Basic details” section in Admin site.

3 -
This is a setting per community and you can change this by modifying the language order in the communities.settings file. You can edit the database directly (be careful as it’s a bit specific formatting there!) or use the following Rails command:

  • find your marketplace by id: com = Community.find(<community_id>)
  • look at the currently available locales: com.settings["locales"]
  • configure your new set and order or locales, for example: com.settings["locales"] = ["en", "fr", "es-ES"]
  • save: com.save!

Hopefully this helps.

Thanks @thomasmalbaux this helps,

Let me clarify question 2 into 2 sub-questions:

2a. Add a new locales into the database but not have it displayed on the menu selection for the visitor: >> this is what you answered right?

2b. Enable an existing language for the visitor >> could you elaborate on this one?

Merci !

Duc

Here’s my take:

2a. Correct. This adds a new language to the “system” in general and makes it available in the admin panel language selection.
2b. You can then simply select it from your admin panel in the “Basic details” section to enable it in your marketplace.

Does it clarify things?

Ah got it. This was possible even with Sharetribe hosted version :)) Thank you.

1 Like