https://github.com/justjavac/deno_language
ISO 639-1 language
https://github.com/justjavac/deno_language
deno deno-mod deno-module deno-modules iso language
Last synced: about 2 months ago
JSON representation
ISO 639-1 language
- Host: GitHub
- URL: https://github.com/justjavac/deno_language
- Owner: justjavac
- License: mit
- Created: 2020-08-10T07:13:25.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-05T15:56:22.000Z (almost 6 years ago)
- Last Synced: 2025-09-26T10:56:47.796Z (9 months ago)
- Topics: deno, deno-mod, deno-module, deno-modules, iso, language
- Language: TypeScript
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# deno_language
[](https://github.com/justjavac/deno_language/releases)
[](https://github.com/justjavac/deno_language/actions)
[](https://github.com/justjavac/deno_language/blob/master/LICENSE)
[ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language.
JSON data from [joker-x/languages.js](https://github.com/joker-x/languages.js/blob/master/languages.json).
## Usage
All ISO 639-1 language code:
```ts
import languages from "https://deno.land/x/language/languages.ts";
console.log(languages)
```
output:
```ts
{
"attribute": { "name": 0, "nativeName": 1 },
"rtl": {
"ar": 1,
"dv": 1,
"fa": 1,
"ha": 1,
"he": 1,
"ks": 1,
"ku": 1,
"ps": 1,
"ur": 1,
"yi": 1,
},
"lang": {
"aa": ["Afar", "Afar"],
"ab": ["Abkhazian", "Аҧсуа"],
"af": ["Afrikaans", "Afrikaans"],
"ak": ["Akan", "Akana"],
...
...
```
Get the writing direction of the language. `"rtl"` or `"ltr"`:
```ts
import { getLangDirection } from "https://deno.land/x/language/mod.ts";
getLangDirection("ar"); // rtl
getLangDirection("zh"); // "ltr"
```
Check if the language code is valid:
```ts
import { isValid } from "https://deno.land/x/language/mod.ts";
isValid("ab"); // true
isValid("zh"); // true
isValid("zz"); // false
```
Get an array with all the language codes supported:
```ts
import { getAllLanguageCode } from "https://deno.land/x/language/mod.ts";
getAllLanguageCode(); // ["aa", "ab", "af", "ak", ..., ...]
```
Get LanguageInfo:
```ts
import { getLanguageInfo } from "https://deno.land/x/language/mod.ts";
getLanguageInfo("en");
// { name: "English", nativeName: "English", direction: "ltr" }
getLanguageInfo("zh");
// { name: "Chinese", nativeName: "中文", direction: "ltr" }
getLanguageInfo("zz");
// null
```
### License
[deno_language](https://github.com/justjavac/deno_language) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details.