This package allows to translate text using Google Translator for free without api.

Overview

Text Translator for PHP

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows text translation using Google Translate for free without an API. It extracts the translated text from the Google Translate website. Meanwhile, it only supports Google Translate.

Supported Languages for Google Translate

https://cloud.google.com/translate/docs/languages

Requirement

The package requires:

  • PHP 8.0 or higher

Installation

You can install the package via composer:

composer require thejano/text-translator

Usage

You can use the package like below example

<?php

require_once __DIR__.'/vendor/autoload.php';

use TheJano\TextTranslator\GoogleTranslator;

$text = 'Hello World';

$translator = new GoogleTranslator();

$translated =  $translator->translate($text,'ckb'); // ckb stands for Kurdish Sorani language 

echo $translated; // Prints سڵاو جیهان

# Or Call statically
GoogleTranslator::translate($text,'ckb'); 

# Translate from Arabic to English 
GoogleTranslator::translate('مرحبا بالعالم','en','ar'); // will returns Hello World

The class GoogleTranslator by default the source language is set to English, also you can override and provide target language on initiation.

new GoogleTranslator(string $sourceLanguage = 'en', string $targetLanguage = '')

The translate method can be called statically or non statically, and it accepts three parameters, which are:

public function _translate(string $text, string $targetLanguage = '', string $sourceLanguage = ''): string;

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

You might also like...
Translate laravel resource, vendor, folder or file from google translation without requiring any api information
Translate laravel resource, vendor, folder or file from google translation without requiring any api information

⚡ ⚡ ⚡ Laravel Go Translate Translate laravel resource, vendor, folder or file from google translation without requiring any api information. Table of

Google Translator Api Wrapper For Php Developers.

Google Translator Api Wrapper For Php Developers.

A simple tool that I share with you. This tool serves to make conversions from text to audio Google Translate.

A simple tool that I share with you. This tool serves to make conversions from text to audio Google Translate. You can download this conversion 100% for free. Good luck.

This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

Multi-language translate module for Silverstripe, without having to manage separate site trees.

Silverstripe-fluent - Multi-language translate module for Silverstripe, without having to manage separate site trees.

Chinese to Pinyin translator for Laravel5 / Lumen based on overtrue/pinyin.

Laravel-pinyin Chinese to Pinyin translator for Laravel5 / Lumen based on overtrue/pinyin. Install composer require "overtrue/laravel-pinyin:~4.0" For

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

Text - Simple 1 Class Text Manipulation Library

Text - Simple 1 Class Text Manipulation Library Do you remember PHP's string functions? If not, just wrap you text with Text! It will save a minute on

Create videos programmatically in the cloud from PHP: add watermarks, resize videos, create slideshows, add soundtrack, voice-over with text-to-speech (TTS), text animations.

Create videos programmatically in the cloud from PHP: add watermarks, resize videos, create slideshows, add soundtrack, voice-over with text-to-speech (TTS), text animations.

Laminas\Text is a component to work on text strings

laminas-text This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering

Zend\Text is a component to work on text strings from Zend Framework

zend-text Repository abandoned 2019-12-31 This repository has moved to laminas/laminas-text. Zend\Text is a component to work on text strings. It cont

Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

Automatically translate and review your content via Lokalise
Automatically translate and review your content via Lokalise

This extension will work as a bridge between Pimcore and Lokalise for the purpose of automating the whole translation workflow. Thus eliminating most of the manual steps in the task along with availing quality translation-review service from Lokalise.

ProcessTranslatePage – A Processwire module to translate all page fields via Fluency

ProcessTranslatePage – A Processwire module to translate all page fields via Fluency ProcessTranslatePage is an extension for the Processwire module F

Laravel Larex lets you translate your whole Laravel application from a single CSV file.
Laravel Larex lets you translate your whole Laravel application from a single CSV file.

Laravel Larex Translate Laravel Apps from a CSV File Laravel Larex lets you translate your whole Laravel application from a single CSV file. You can i

Translate eloquent entity models

Translate entity About package This package is intended for adding multi language support to your models. If your application already be working and y

Magento commands to find translations that are present in one CSV file but not in another, and to translate CSV dicts with DeepL
Magento commands to find translations that are present in one CSV file but not in another, and to translate CSV dicts with DeepL

Hyvä Themes - Magento translation CSV comparison command hyva-themes/magento2-i18n-csv-diff This module adds the bin/magento i18n:diff-csv and i18n:tr

Comments
Releases(1.1.0)
Owner
The Jano
Publishing open source packages
The Jano
Brings localization feature to tightenco/jigsaw using JSON files

Jigsaw localization Brings localization feature to tightenco/jigsaw using JSON files. Get started Setup Bring jigsaw-localization to your Jigsaw proje

Elaborate Code 6 Nov 1, 2022
[Deprecated] A Laravel package for multilingual models

This package has been deprecated. But worry not. You can use Astrotomic/laravel-translatable. Laravel-Translatable If you want to store translations o

Dimitris Savvopoulos 2k Dec 25, 2022
Package to manage Laravel translations locally

Translation Manager For Laravel Easy to use package that helps you with the translation of your Laravel application locally. Features ✅ Check all loca

null 5 Jan 8, 2022
A convenience package for php multilingual web applications

PHP Translation Install Lifecycle Configuration Content of PHP File Content of Json File Content Of Database Table Use Of Array Or Json Database PHP T

Ahmet Barut 3 Jul 7, 2022
pH7CMS Internationalization package.

?? pH7CMS Internationalization (I18N) package ?? Get new languages for your pH7CMS website!

pH7 Social Dating CMS (pH7CMS) 18 Oct 5, 2022
Composer package providing translation features for PHP apps

PHP translation This is a composer package providing translation support for PHP applications. It is similar to gettext, in usage, with these differen

Sérgio Carvalho 0 Aug 15, 2022
Official PHP library for the DeepL language translation API.

deepl-php Official PHP client library for the DeepL API. The DeepL API is a language translation API that allows other computer programs to send texts

DeepL 78 Dec 23, 2022
🌐 Free Google Translate API PHP Package. Translates totally free of charge.

Google Translate PHP Free Google Translate API PHP Package. Translates totally free of charge. Installation Basic Usage Advanced Usage Language Detect

Levan Velijanashvili 1.5k Dec 31, 2022
A Concrete CMS package to add interfaces to translate multilingual content. You can translate content manually, or use cloud API.

Concrete CMS add-on: Macareux Content Translator Concrete CMS has powerful features to manage multilingual content by its default. You can add languag

株式会社マカルーデジタル 3 Nov 28, 2022
Library for free use Google Translator. With attempts connecting on failure and array support.

GoogleTranslateForFree Packagist: https://packagist.org/packages/dejurin/php-google-translate-for-free Library for free use Google Translator. With at

Yurii De 122 Dec 23, 2022