Skip to content

Support to ISO-639-3 language codes #2836

@futurespy

Description

@futurespy

Is your feature request related to a problem? Please describe.

The new I18n feature only supports languages listed on ISO-639-1. ISO-639-3 codes are simply ignored, but some languages are only listed in the 3rd standard. Consequently, post.url | locale_links doesn't return the link to the content in these unlisted languages.

Describe the solution you'd like

A quick dirty fix would be adding:

const languagesByIso6393Code = require('wikidata-lang/indexes/by_iso_639_3_code')

...

if (!iso639.validate(s) && !languagesByIso6393Code[code]) {
return false;
}

...

   filemap[replaced].push({
     url,
     lang: langCode,
     **label: (iso639.getNativeName(langCode.split("-")[0]) ? iso639.getNativeName(langCode.split("-")[0]) : (languagesByIso6393Code[langCode][0]['native'] ? languagesByIso6393Code[langCode][0]['native'] : languagesByIso6393Code[langCode][0]['label'])),**
   });

Describe alternatives you've considered

Is there anyway I could override the plugin in my Eleventy installation?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions