Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Latest commit

 

History

History
34 lines (26 loc) · 1.32 KB

cp.i18n.language.md

File metadata and controls

34 lines (26 loc) · 1.32 KB

docs » cp.i18n.language


Provides the set of ISO 693-1/2/3 language codes and names. The return value can be iterated as a list, or you can find a specific language by either its two-character code (alpha2), English-based three-character code (alpha3B), local name, or English name.

For example:

local lang = require("cp.i18n.language")
print(lang[1]) -- table for "Abkhaz" language
print(lang.fr) -- table for "French"
print(lang.fre) -- same table for "French"
print(lang["Français"]) -- same table for "French"
print(lang.French) -- same table for "French"

This will return a table containing the following:

  • alpha2 - The 2-character language code (eg. "en", "fr").
  • alpha3 - The 3-character language code (eg. "eng", "fra").
  • alpha3B - The 3-character English-derived language code (eg. "eng", "fre").
  • alpha3T - The 3-character local-language-derived code (eg. "eng", "fra").
  • localName - The name in the local language (eg. "English", "Français").
  • name - The name in English (eg. "English", "French").

Note: This data was adapted from arnubol's code under an MIT license.

API Overview

API Documentation