google-cloud-translation-languages

0.1.3 • Public • Published

Google Cloud Translation Languages

Build Status Version Downloads

Maps the languages currently supported by operations of the Google Cloud Translation API. The data auto-updates every 3 days, if needed.

Usage

const { isLanguageSupported } = require("google-cloud-translation-languages");

console.log(isLanguageSupported("en"));
// true

API

Access to supported languages

The raw sets of supported languages, as returned by Google Cloud Translation API, are made accessible:

const { languages } = require("google-cloud-translation-languages");

console.log(languages);
// [{language: 'hu', name: 'Hungarian'}, {…}, {…}, …]

// OR
const gct = require("google-cloud-translation-languages");

console.log(gct.dataLanguages);
// [{language: 'hu', name: 'Hungarian'}, {…}, {…}, …]

Check if a language is supported

isLanguageSupported(code) returns whether a language is supported or not:

  • code must be a BCP 47 language tag, as per ISO 3166-1
const { isLanguageSupported } = require("google-cloud-translation-languages");

console.log(isLanguageSupported("en"));
// true

console.log(isLanguageSupported("hu"));
// true

License

google-cloud-translation-languages is released under the MIT License. See the bundled LICENSE file for details.

Package Sidebar

Install

npm i google-cloud-translation-languages

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

12.6 kB

Total Files

5

Last publish

Collaborators

  • eliottvct