4.12.106 • Published 10 months ago

@diotoborg/beatae-illo v4.12.106

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Build Status npm version Maintainability Test Coverage

i18n-iso-languages

i18n for ISO 639 language codes. We support Alpha-2, Alpha-3 B and T codes from https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

This packages is heavily based on i18n-iso-countries.

We intent to keep the interface of i18n-iso-languages as close as possible to i18n-iso-countries.

Installing

Install it using npm: npm install @diotoborg/beatae-illo

If used in a browser environment, you will need to manually install the local you wish to support.

var languages = require("@diotoborg/beatae-illo");

// Support german & english languages.
languages.registerLocale(require("@diotoborg/beatae-illo/langs/en.json"));
languages.registerLocale(require("@diotoborg/beatae-illo/langs/de.json"));

Code to Language

Get the name of a language by it's ISO 639-1 (Alpha-2), ISO 639-2/T or B (Alpha-3) code

var languages = require("@diotoborg/beatae-illo");
console.log("de (639-1/Alpha-2) => " + languages.getName("de", "en")); // German
console.log("en (639-1/Alpha-2) => " + languages.getName("de", "de")); // Deutsch
console.log("de (639-2T/Alpha-3) => " + languages.getName("deu", "en")); // German
console.log("de (639-2B/Alpha-3) => " + languages.getName("ger", "en")); // German

Get all names by their ISO 639-1 code

var languages = require("@diotoborg/beatae-illo");
console.log(languages.getNames("en")); // { 'ab': 'Abkhazian', 'aa': 'Afar', [...], 'za': 'Zhuang', 'zu': 'Zulu' }

Supported languages (ISO 639-1)

List of ISO 639-1 codes

Language to Code

var languages = require("@diotoborg/beatae-illo");
console.log("German => " + languages.getAlpha2Code('German', 'en'));
// German => de

console.log("German => " + languages.getAlpha3TCode('German', 'en'));
// German => deu

console.log("German => " + languages.getAlpha3BCode('German', 'en'));
// German => ger

Codes

Convert ISO 639-2 (Alpha-3) to ISO 639-1 (Alpha-2) code

var languages = require("@diotoborg/beatae-illo");
console.log("deu (Alpha-3) => " + languages.alpha3ToAlpha2("deu") + " (Alpha-2)");
// deu (Alpha-3 T) => de (Alpha-2)

var languages = require("@diotoborg/beatae-illo");
console.log("ger (Alpha-3 B) => " + languages.alpha3ToAlpha2("ger") + " (Alpha-2)");
// ger (Alpha-3 B) => de (Alpha-2)

Convert ISO 639-1 (Alpha-2) to ISO 639-2 (Alpha-3) code

var languages = require("@diotoborg/beatae-illo");
console.log("de (Alpha-2) => " + languages.alpha2ToAlpha3T("de") + " (Alpha-3 T)");
// de (Alpha-2) => deu (Alpha-3 T)

var languages = require("@diotoborg/beatae-illo");
console.log("de (Alpha-2) => " + languages.alpha2ToAlpha3B("de") + " (Alpha-3 B)");
// de (Alpha-2) => ger (Alpha-3 B)

Get all ISO 639-1 (Alpha-2) codes

var languages = require("@diotoborg/beatae-illo");
console.log(languages.getAlpha2Codes());
// { 'aa': 'aar', 'ab': 'abk', [...], 'za': 'zha', 'zu': 'zul' }

Get all ISO 639-2 (Alpha-3) codes

var languages = require("@diotoborg/beatae-illo");
console.log(languages.getAlpha3TCodes());
// { 'aar': 'aa', 'abk': 'ab', [...], 'zha': 'za', 'zul': 'zu' }

var languages = require("@diotoborg/beatae-illo");
console.log(languages.getAlpha3BCodes());
// { 'aar': 'aa', 'abk': 'ab', [...], 'zha': 'za', 'zul': 'zu' }

Validate language code

var languages = require("@diotoborg/beatae-illo");
console.log(languages.isValid("de"), languages.isValid("ger"), languages.isValid("xx")));
// true, true, false

Contribution

To add a language:

  • add a json file under langs/ (in alphabetical order)
  • add the language to the data object in enty-node.js at the top (in alphabetical order)
  • add language to section Supported languages in README.md (in alphabetical order)
  • add language to keywords in package.json (in alphabetical order)
  • add language to the "unreleased" section of the changelog
  • run npm install && make test to make sure that tests are passing
  • open a PR on GitHub

Please do not change the version in package.json, package-lock.json or changelog.md.

look-upES2018ownjson-schemainternaltestinges-shim APIclass-validatorgenericsReactiveXstyled-componentspackageseslintresolveform-validationpoint-freeentriesserviceonceeveryreducerStreamsarraybufferuninstallpromisespecsettingstypedservergetdescriptorYAMLfindLastIndexhasOwnfixed-width0jsdomMapRxemojiescapemrutypeerrorreact-hooksObservablesRxJSvalidationsymbolcomputed-typestouchtc39errorremovebrowserfull-widthdataViewtoStringTagwarningSymbolinternal slotlookpnpm9storagegatewayvarscolumnshandlerroute53positivewebflatMapeventsdropES3json-schema-validationreact-hook-formArray.prototype.flatstylestransformruntimeArrayBufferlrubddcolumn3dinputfastcopyreverseES7installereffect-tstoolkitflatpackage managertranspilerargsfast-deep-copycjktimeenderbundlingtesterwritablel10nbyteOffsetrangeerrorargvcssECMAScript 2022invariantreadables3equalJSONes5typed arrayvpcmocklocationfastphonequeryexpressES8loadingpicomatchenvironmentmochaperformantgetintrinsicclassesstyleguidenameaccessibilityserializationajvreadablestreamBigUint64ArraydataviewdotenvgitignoreelectronUint16Arrayworkerexecio-tses2017mapreducetextWeakSetprunefast-deep-clonerequestworkflowRFC-6455manipulationrfc4122childconsoleeast-asian-widthatomtoArraygetterkinesiscreateArraysinatrainferenceobjectObjecttypeparentesviewfpgesturestypedarraysjavascriptformsfast-copyfetchcommandrgbincludesiteratorCSSIteratorloadbalancingnodejsomitprogressnopetypanionworkspace:*tostringtagcallutilfoldertypeof.gitignoreiamreal-timewafreact animationasyncFunction.prototype.namewriteunicodeUint8Array-0jQueryinspectObject.entrieshttpsbannerrandomfunction.lengthprivateeventDispatcherprotobuffastifyAsyncIteratorimmutableflagsJSON-SchemarestsuperstructfastclonewhichFloat32ArraytrimRightschemapopmotionjshintmockingRegExp#flagshigher-orderparentsUint8ClampedArrayqsReactiveExtensionssetImmediateoptimizercomparevisualemitcall-bindprototypePromisezodintrinsiceventEmittershebangelasticachecolorObject.keysprotocol-bufferspostcssaccessorefficientreworkdeepcopyjsonECMAScript 3definerobustassertsbytepostcss-pluginreverseddeepnoderoutingthreeES2021Array.prototype.flattenstylingclientfind-upcodesforkieloggerpinofigletflagec2ajaxenvnumberdefinePropertypurespringsettypescriptproxyawswalkisrestfulprocessawesomesauceelbnames6to5copyjsfront-endmodulesdescriptorsemrconfigurablefilefullmapdeterministicreadeslint-pluginECMAScript 2015cachebufferlockfileprivate dataArray.prototype.flatMapnativeyamlroutehas-ownsuperagentmomentmulti-packagedependency managerstarterObservablesetterfindLastjoicore-jskoreanUnderscoreletgdpri18ncallbindxmlxtermbyteLengthstablevaluesdescriptionbeanstalktrimStart_.extendspinnerInt8Arrayextrareducehashparsecollection.es6regexpgraphqlschemees-abstractperformanceString.prototype.matchAlllistenersString.prototype.trimES2016ES2017curllastmkdirdeepclonejsdiffspeedredirecttrimLeftmkdirpconstES2020takeamazoncommanderrdslocalECMAScript 6call-boundautoprefixerdependenciestraverseappcallboundtrimpatchreact-testing-libraryidleObject.isFloat64ArrayBigInt64ArrayESiteratelibphonenumberzerofilterjasmineinstallredux256Array.prototype.containsecmascriptfnmatchstringpyyamlconcatHyBisqsprettysnsPushdeletevariablesvalidateupdiffsafeMicrosoftrouterkeysrm -rfcloudsearchStyleSheetpipeimportexportcryptoserializermonorepotypedarrayarraysfromclienvironmentsuuidfunctionalserializearktypetoobjectestreeanimationdomcheckbabel-coreInt16ArraysymlinksArrayBuffer#slicesubprocesssyntaxerrorconcatMapside$.extendrulesObject.definePropertyclassnamestreamsparsersameValueZeroutilitiesidentifiersArray.prototype.filterarrayclassnameshooksutil.inspecttranspileRegExp.prototype.flagsttyinstrumentationponyfillsetPrototypeOfcloudwatchbusygroupback-endECMAScript 2019karmawgetes-shimsWebSocketreact posepackage.jsonlinktransportframeworkobjindicatorargumentendpointtacityupquotepropertyECMAScript 2020airbnbcommand-lineharmonytestglobal
4.12.106

10 months ago

4.12.105

10 months ago

4.12.104

10 months ago

4.12.103

10 months ago

4.12.102

10 months ago

4.12.101

10 months ago

4.12.100

10 months ago

4.12.99

10 months ago

4.12.98

10 months ago

4.11.98

10 months ago

4.11.97

10 months ago

4.11.96

10 months ago

4.11.95

11 months ago

4.11.94

11 months ago

4.11.93

11 months ago

4.10.93

11 months ago

4.10.92

11 months ago

4.10.91

11 months ago

4.10.90

11 months ago

4.10.89

11 months ago

4.10.88

11 months ago

4.10.87

11 months ago

4.10.86

11 months ago

4.10.85

11 months ago

4.10.84

11 months ago

4.10.83

11 months ago

4.9.83

11 months ago

4.9.82

11 months ago

4.9.81

11 months ago

4.8.81

11 months ago

4.8.80

11 months ago

4.8.79

11 months ago

4.8.78

11 months ago

4.8.77

11 months ago

4.8.76

11 months ago

4.8.75

11 months ago

4.8.74

11 months ago

4.8.73

11 months ago

3.8.73

11 months ago

3.8.72

11 months ago

3.8.71

11 months ago

3.7.71

11 months ago

3.7.70

12 months ago

3.7.69

12 months ago

3.7.68

12 months ago

3.7.67

12 months ago

3.7.66

12 months ago

3.7.65

12 months ago

3.7.64

12 months ago

3.7.63

12 months ago

3.7.62

12 months ago

3.7.61

12 months ago

3.7.60

12 months ago

3.7.59

12 months ago

2.7.59

12 months ago

2.7.58

12 months ago

2.7.57

12 months ago

2.7.56

12 months ago

2.7.55

12 months ago

2.7.54

12 months ago

2.7.53

12 months ago

2.7.52

12 months ago

2.7.51

1 year ago

2.7.50

1 year ago

2.7.49

1 year ago

2.7.48

1 year ago

2.7.47

1 year ago

2.7.46

1 year ago

2.7.45

1 year ago

2.7.44

1 year ago

2.7.43

1 year ago

2.7.42

1 year ago

2.7.41

1 year ago

2.7.40

1 year ago

2.7.39

1 year ago

2.7.38

1 year ago

2.7.37

1 year ago

2.7.36

1 year ago

2.7.35

1 year ago

2.7.34

1 year ago

2.7.33

1 year ago

2.6.33

1 year ago

2.5.33

1 year ago

2.5.32

1 year ago

2.5.31

1 year ago

2.4.31

1 year ago

2.3.31

1 year ago

2.2.31

1 year ago

2.2.30

1 year ago

2.2.29

1 year ago

2.2.28

1 year ago

2.2.27

1 year ago

2.2.26

1 year ago

2.2.25

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago