npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

languages-details

v1.0.3

Published

This package provides detailed information about various languages, including locale codes, simple language codes, and support across popular translation services such as Google Translate, AWS Translate, Microsoft Translator, and others.

Downloads

238

Readme

Language Details Package

A comprehensive npm package that provides detailed information about various languages, including locale codes, simple language codes, and whether they are supported by popular translation services such as Google Translate, AWS Translate, Microsoft Translator, and more.

Installation

You can install the package using npm:

npm install language-details

Or using yarn:

yarn add language-details

Usage

The package provides multiple functions to check the validity of language codes, retrieve language names, and check translation availability.

Example Usage

const languageDetails = require('language-details');

// Check if a language code is valid const isValid = languageDetails.isValid('af'); console.log(isValid); // Output: Afrikaans (af) is a valid language code.

// Retrieve the name of a language by its code const languageName = languageDetails.getLanguageName('af'); console.log(languageName); // Output: Afrikaans

// Check translation availability for a given language code const translationAvailability = languageDetails.checkTranslationAvailability('af'); console.log(translationAvailability); /_ Output: [ { name: 'Afrikaans', locale: 'af-ZA', googleTranslate: true, microsoftTranslate: true, deeplTranslate: false, awsTranslate: true, ibmTranslate: false, awsTranscribe: false, googleStt: false, googleTTS: false, awsPolly: false } ] _/

Available Functions

  • isValid(langcode): Checks if the given language code is valid and returns the language name along with its code if valid.
  • getLanguageName(langcode): Retrieves the name of the language based on the provided language code.
  • checkTranslationAvailability(code): Checks the availability of the language across multiple translation and speech services like Google Translate, AWS Translate, etc.

API

isValid(languageCode)

  • Parameters: languageCode (string) - The language code you want to validate.
  • Returns: A string indicating if the language code is valid and the corresponding language name.

getLanguageName(languageCode)

  • Parameters: languageCode (string) - The language code for which you want the language name.
  • Returns: The full name of the language if the code is valid, otherwise null.

checkTranslationAvailability(code)

  • Parameters: code (string) - The language code for which you want to check translation availability.
  • Returns: An array of objects containing translation service availability information for the given language code.

Supported Translation Services

  • Google Translate: Simple language code compatible with Google Translate.
  • Microsoft Translator: Language code supported by Microsoft’s translation services.
  • DeepL: Indicates if the language is supported by DeepL.
  • AWS Translate: Simple language code used by AWS Translate.
  • IBM Watson: Indicates if the language is supported by IBM Watson Language Translator.
  • AWS Transcribe: Code for AWS Transcribe speech recognition.
  • Google STT: Code for Google Speech-to-Text.
  • Google TTS: Code for Google Text-to-Speech.
  • AWS Polly: Code for AWS Polly Text-to-Speech.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

If you'd like to contribute to the package, feel free to submit issues or pull requests on the GitHub repository.

Running Tests

Make sure to write unit tests for your changes.

npm test

License

This project is licensed under the MIT License. See the LICENSE file for details.