Is there a programmatic way (or some open-source repository), that given a language (say in 2-leters ISO format), return the letters of the alphabet of that language?
For example:
console.log(getAlphabet('en'));
outputs:
a b c d ...
and
console.log(getAlphabet('he'));
outputs:
א ב ג ד ...
I don't think that a language always has a well-defined alphabet associated with it. But in the Unicode CLDR standard, the
//ldml/characters/exemplarCharactersseem to contain a "representative section" of letters typically used in a given language. This comes in an open-source repository, see here for Hebrew, for example.Using an XML parser library, you can write a function that loads the file based on the language code (in the example above, https://raw.githubusercontent.com/unicode-org/cldr/HEAD/common/main/he.xml for language code
he) and locates the//ldml/characters/exemplarCharacterselement in it.Below is an example function in client-side Javascript.