1.0.11 • Published 2 years ago

api-translator v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

GitHub last commit npm bundle size GitHub Workflow Status

A free and unlimited translator for Node.js

🈂️ ⠀free text translator for Node.js.

Install

To install api-translator, you can use:

# npm
npm i api-translator
# or with yarn
yarn add api-translator
#or with pnpm
pnpm add api-translator

Quick examples

const { translate } = require("api-translator");

(async () => {
	const translatedText = await translate("Hello World", {
		from: "en",
		to: "ar",
	});

	console.log(translatedText); // اهلا بالعالم
})();

Automatic language recognition

If the language informed in the from is dynamic, just do not send it and the translator will automatically recognize it:

const { translate } = require("api-translator");

(async () => {
	const translatedText = await translate("This is cool!", { to: "ar" });

	console.log(translatedText); // هذا رائع!
})();

Multiple texts (Array)

You can also translate multiple texts at the same time:

const { translate } = require("api-translator");

(async () => {
	const translatedText = await translate(["Hello World", "This is cool!"], {
		to: "ar",
	});

	console.log(translatedText); // [ 'اهلا بالعالم', 'هذا رائع!' ]
})();

Multiple texts (Object)

You can also translate a json object:

const { translate } = require("api-translator");

(async () => {
	const obj = {
		Home: "Home",
		About: "About",
		Contact: "Contact",
		Login: "Login",
	};
	const result = await translate(obj, { to: "fr" });
	console.log(result); // { Home: 'Maison', About: 'Maison', Contact: 'Contact', Login: 'Connexion' }
})();

Contributing

  • If you want to contribute to the project, you can do it by opening a pull request or opening an issue.

Contact me!

  • E-mail el3zahaby@gmail.com
  • Instagram @egyjs
1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.1

2 years ago