jjoswig/azure-translator

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

AzureTranslator plugin for CakePHP

dev-master 2020-05-01 15:15 UTC

This package is auto-updated.

Last update: 2021-08-29 02:23:58 UTC


README

Purpose

When creating contents, e. g. blog posts, it might be handy to automatically translate them into other languages. There are several translation services available, such as Azure Translator, that are even for free.

I created a CakePHP plugin that triggers the Azure Translator service interfaces, hands over text and receives the translated texts.

Prerequisites

To use this plugin you need the following:

  • A running CakePHP 4 installation
  • An valid Azure subscription

Setup Azure Translator

  1. Log in to your Azure tenant
  2. Add a Translator Text resource from the Azure marketplace (https://portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation )
  • Choose the F0 pricing tier that allows translation of up to 2M characters per month
  1. Get one of the two API keys to use as authentication against Azure Translator

Installation

  1. You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require jjoswig/AzureTranslator
  1. Set up the Azure component by adding the API key to your environment variables (config/.env)
export AZURE_TRANSLATE_ENDPOINT="https://api-eur.cognitive.microsofttranslator.com"
export AZURE_TRANSLATE_KEY="**SUBSCRIPTION_KEY_HERE**"

More Information

More information on this plugin and the Azure Translator service inparticular can be found here: