MasonSchleider / PSTranslate

A PowerShell module for translating text between languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PSTranslate

Note: This module is a work in progress!

PSTranslate is a PowerShell module for translating text between languages.

It utilizes Microsoft Azure's Translator Text API.

Setup

Note: At the moment, this module requires one to have a Microsoft Azure account. Other translation services/methods may be added in the future.

Steps

  1. If you do not already have a Microsoft Azure account, create a free account here.
  2. Sign in to your Microsoft Azure portal.
  3. Click + Create a resource, at the top of the navigation menu docked to the left side of the page.
  4. In the Search the Marketplace search box, type Translator Text, and then select it from the results.
  5. Click the Create button, at the bottom-right of the page.
  6. Enter the requested information and select your desired options in the Create form.
    If this is your first time using Microsoft Azure, enter/select the following:
    • Name: Any name; I used TranslatorTextAPI
    • Subscription: Free Trial
    • Pricing tier: F0
    • Resource group: Create new, any name; I used Default
    • Resource group location: Central US
  7. Click the Create button, at the bottom of the form.
  8. After the Translator Text resource has finished initializing, select it from the resource list on your dashboard.
  9. In the resource navigation menu, under Resource Management, select Keys.
  10. Copy KEY 1.
  11. Create the file Credentials.ps1 in PSTranslate\src.
  12. Add the following PowerShell command to the Credentials.ps1 file:
    Set-Variable PSAzureTranslateApiKey 'YOUR_KEY_1' -Scope Global

Usage

Get-LanguageList

Retrieves a list of all the languages to/from which text can be translated.

Get-LanguageList

Get-Language

Attempts to determine the language of a specified string.

Get-Language 'Parlez-vous francais?'

Get-Translation

Translates a specified string.

Get-Translation 'Parlez-vous francais?'
Get-Translation 'Do you speak French?' -To 'fr'

About

A PowerShell module for translating text between languages.

License:GNU General Public License v3.0


Languages

Language:PowerShell 100.0%