Closed zackkrida closed 2 years ago
The iso
field is used by Nuxt i18n to fill in the hreflang
attribute for alternative links to other language versions of the page inside the head for SEO purposes.
It is supposed to be in ISO 639-1
format, with optional country codes. Some of the locales in the valid-locales.json
don't have an ISO 639-1
code assigned to them.
I think we could simply use ...(locales.filter((i) => i.iso) ?? []),
to filter out these locales, as they do not have any translations available.
Is this (the missing iso
field) something we should also report upstream to the WP i18n folks?
Description
This error warning shows up ~38 times in development, per page refresh / load. This is caused by some locales in https://github.com/WordPress/openverse-frontend/blob/text-color-fixes/src/locales/scripts/valid-locales.json that don't have an
iso
attribute.We should identify why these languages don't have an iso, and fix or remove the languages.
If you replace this line
https://github.com/WordPress/openverse-frontend/blob/c6f06754475690a88114b19af462df8ee64a9c9f/nuxt.config.js#L166
with
...(locales.filter((i) => i.iso) ?? []),
you can observe these errors disappear.Resolution