LBeaudoux / iso639

A fast, simple ISO 639 library.
MIT License
33 stars 5 forks source link

Also support MARC List for Languages #20

Closed rettinghaus closed 4 months ago

rettinghaus commented 4 months ago

The MARC List for Languages is mainly compatible with ISO 639-3, but not completely. In library contexts it would be nice to also allow additonal mapping from/to MARC codes (see https://id.loc.gov/vocabulary/languages.html), or at least add a helper if a given ISO code matches the respective one from MARC.

LBeaudoux commented 4 months ago

According to the page about MARC language codes that you shared:

The codes in this list are equivalent to those of ISO 639-2 (Bibliographic) codes and some codes from ISO 639-5, although the language name labels may differ.

This means that you should be able to instantiate Lang with any MARC language code:

>>> Lang("ger")
Lang(name='German', pt1='de', pt2b='ger', pt2t='deu', pt3='deu', pt5='')
>>> Lang("ber")
Lang(name='Berber languages', pt1='', pt2b='ber', pt2t='', pt3='', pt5='ber')

I hope it solves your use case, as I don't plan to extend this package beyond the ISO 639 standard.

rettinghaus commented 4 months ago

Thanks for the answer, I think that should work for me.