🚀 DAY 3 OF LAUNCH WEEK: Introducing Webhook Events for Pull Request Scans.Learn more →
Socket
Book a DemoInstallSign in
Socket

google-cloud-translation-languages

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-cloud-translation-languages

Maps supported languages by Google Cloud Translation

latest
Source
npmnpm
Version
0.1.6
Version published
Maintainers
1
Created
Source

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.

Keywords

google-cloud-translation

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts