New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

html-google-translate

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-google-translate

Translate HTML with Google Translate and maintain the original structures of sentences and HTML.

latest
Source
npmnpm
Version
1.0.12
Version published
Maintainers
1
Created
Source

html-google-translate

Translate HTML with Google Translate and maintain the original structures of sentences and HTML.

const html = '<p><i>I</i> love <a href="#">you</a>!</p>'

const transHtml = await translate(html, {
  from: 'en',
  to: 'es',
})

// '<p><i>Me</i> encanta <a href="#">que</a> !</p>'

Installation

$ npm install html-google-translate

API

translate(html, options)

const transHtml = await translate(html, {
  from: 'auto',
  to: 'en',
  tld: 'com',
  proxy: {
    host: '127.0.0.1',
    port: 9000,
    auth: {
      username: 'username',
      password: 'password',
    },
  },
  xmlMode: false,
})

html

Type: string

The HTML to be translated.

options

Type: object

from

Type: string | 'auto'

The html language. Must be auto or one of the codes/names (not case sensitive) contained in languages.ts.

to

Type: string

The language in which the HTML should be translated. Must be one of the codes/names (case sensitive!) contained in languages.ts.

tld

Type: string Default: 'com'

TLD for Google translate host to be used in API calls: https://translate.google.{tld}.

proxy

Type: AxiosProxyConfig | false Default: false

Proxy for request, AxiosProxyConfig.

xmlMode

Type: boolean | 'foreign' Default: false

Indicate whether to render the result in XML.

Keywords

html

FAQs

Package last updated on 17 Sep 2019

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