Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\<language> iso_code attribute mixing ISO country codes with ISO languages codes #43

Open
rickygzz opened this issue Jan 2, 2022 · 0 comments

Comments

@rickygzz
Copy link
Contributor

rickygzz commented Jan 2, 2022

Localization files, in their \<languages> tag, are mixing two different ISO codes (ISO 639 language codes and ISO 3166 country codes)

For example, in mx.xml it is showing:

	<languages>
		<language iso_code="mx" />
		<language iso_code="es" />
	</languages>

Which is mixing the mx ISO3166 country code with the es ISO639 language code. Said in other words, there is no language ISO code mx .

So it would be preferable, to delete the mx line and to create a new attribute called locale . Locale will be using the naming convention of mixing the language and country codes (es-MX) that represents a specific geographical, political or cultural region.

	<languages>
		<language iso_code="es" locale="es-MX" />
	</languages>

Actually, the translations in PrestaShop follows that locale naming convention (using es-MX in app/Resources/translations directory):

image

With that new attribute we would be able to create unique locale XML files (like es-MX.xml) to specify all the locale regional information (translations, monetary conventions, decimal formatting conventions, units, date and time formatting conventions and collation/sort order). It would be easier to maintain.

Many countries would benefit from it. For example, Belgium which has two locale fr-BE and nl-BE, see the differences https://www.localeplanet.com/icu/fr-BE/index.html and https://www.localeplanet.com/icu/nl-BE/index.html.

I believe adding this new attribute won't hurt while we put the efforts to create each locale XML file. Also it will be easier to maintain. We could extract the locale data using the website https://www.localeplanet.com/icu/ for each country or region, it won´t be hard.

But I still don´t know how much impact will it have to recode the existing classes. Also, I still need to investigate, the impact on deleting the <language iso_code="mx" /> line.

For now, it appears to be two places where language identifier is used after importing the Mexico language pack.

  1. Inside International / Localization / Languages tab / Edit Español MX shows for Language code = es.

image

  1. Inside International / Localization / Localization tab / Advanced, the Language identifier = mx.

image

The second one is totally wrong, PS BO explicitly shows that Language identifier should be the ISO 639-1 code (and mx is not an ISO 639-1).

But it got me thinking, why would you have Language code and Language identifier in two separate places? And how each one pulls its config data (why the first one is es and the second one is mx)?

I would make sense if both fields pulled its data from the same place in LocalizationFiles repository. But the first one is pulled from install-dev/langs/mx/language.xml and the second one from the first <language iso_code="mx" /> occurence in mx.xml.

I will keep trying to figure out the best approach, but it would be nice if somebody else hops in and give us their thinking about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant