🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

afrotranslate

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

afrotranslate

AfroTranslate - Effortless language translation and detection, with a focus on Ethiopian languages.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

AfroTranslate

AfroTranslate is a lightweight language translation and detection package focused on Ethiopian languages, enabling translations from any language to Amharic, Tigrinya, Oromo, and more. With built-in language detection, it helps bridge communication by supporting diverse Ethiopian languages in a simple, efficient way.

Installation

To install the package, you can use npm:

npm install afrotranslate

Importing the Package

You can import the package in your JavaScript project as follows:


const { translate, detectLanguage } = require('afrotranslate');

Usage

Here’s how to use the translate and detectLanguage functions:

Translate Function


const translationResult = await translate("Hello, world!", "am");
console.log("Translation:", translationResult.translatedText);
Detect Language Function
javascript
Copy code
const detectedLanguage = await detectLanguage("Bonjour");
console.log("Detected Language:", detectedLanguage);

Example

Here’s a full example that demonstrates how to use the AfroTranslate package:


const { translate, detectLanguage } = require('afrotranslate');

async function runExample() {
    try {
        // Translate to Amharic
        const translationResult = await translate(
            "We cannot solve problems with the kind of thinking we employed when we came up with them.",
            "am"
        );
        console.log("Detected Language:", translationResult.detectedLanguage);
        console.log("Translation:", translationResult.translatedText);

        // Detect language
        const detectedLanguage = await detectLanguage("Bonjour");
        console.log("Detected Language from Bonjour:", detectedLanguage);
    } catch (error) {
        console.error("An error occurred:", error);
    }
}

// Run the example function
runExample();


License

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

Contributing

Contributions are welcome! Check the issues for any open tasks or feature requests. Feel free to submit a pull request for improvements or new features.

GitHub Repository

Find the source code and more information on GitHub.

Keywords

translation

FAQs

Package last updated on 02 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