Multiple Spanish Languages

Created on 4 April 2024, 7 months ago

The website I'm working on supports two different versions of Spanish:

Spanish, Europe
Spanish, Latin America

By default, Drupal supports a single Spanish language (i.e. es). You can also add a custom language. For this website, we would like to use the following language codes:

es-es
es

This works great so far, however, the problem comes with this XTM module when sending pages to be translated. In looking at the code, the module will tell you if the language is supported or not when you try to send a page in to XTM for translation. Specifically, inside the module there is a countryList.json file that lists out all the supported language codes and any variants to a language. For Spanish, there is a single language code entry (es):

"es":[{"es_ES":"Spanish (Spain)"},{"es_AR":"Spanish (Argentina)"},{"es_BO":"Spanish (Bolivia)"},{"es_CL":"Spanish (Chile)"},{"es_CO":"Spanish (Colombia)"},{"es_CR":"Spanish (Costa Rica)"},{"es_CU":"Spanish (Cuba)"},{"es_DO":"Spanish (Dominican Republic)"},{"es_EC":"Spanish (Ecuador)"},{"es_SV":"Spanish (El Salvador)"},{"es_GT":"Spanish (Guatemala)"},{"es_HN":"Spanish (Honduras)"},{"es_001":"Spanish (International)"},{"es_419":"Spanish (Latin America)"},{"es_MX":"Spanish (Mexico)"},{"es_NI":"Spanish (Nicaragua)"},{"es_PA":"Spanish (Panama)"},{"es_PY":"Spanish (Paraguay)"},{"es_PE":"Spanish (Peru)"},{"es_PR":"Spanish (Puerto Rico)"},{"es_UY":"Spanish (Uruguay)"},{"es_US":"Spanish (USA)"},{"es_VE":"Spanish (Venezuela)"},{"es_NT":"Spanish (Neutral)"}],

From what I can tell, what this means is that if you add a custom language in Drupal using the language code "es-es" then this module will say the language is not supported because there is no key for "es-es". There's a variant for "es-es" within "es".

I noticed the language English has the same issue for the most part. However, it has a second entry for "en-gb" in addition to "en", so that you can have two English variants.

How can I add support for two Spanish languages, one with the es-es code and the other with the es code?

πŸ’¬ Support request
Status

Active

Version

6.5

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bobthebuilder

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024