gg_translate: Translate text from English to Chinese along data frame

View source: R/transgg.R

gg_translateR Documentation

Translate text from English to Chinese along data frame

Description

Translate text from English to Chinese along data frame

Usage

gg_translate(df, col_key, col_trans, ggkey)

Arguments

df

data frame. The names of columns should be non-multibytes string.

col_key

character. Which column will be kept as a "key column", and can be used with data frame join (left_join()).

col_trans

character. Which column will be translated.

ggkey

character. google translate API key, which is a long string containing upper and lower case letters, numbers, and dashes, such as ⁠a4db08b7-5729-4ba9-8c08-f2df493465a1⁠.

Value

result

Examples


df_my <- tibble::tibble(
  index = 1:3,
  target = c(
    'We recommend you use the Cloud Console to manage API keys.',
    'Your API keys are shown in the API keys section.',
    'Pass the API key into a REST API call as a query parameter with the following format.'
    )
 )
## Not run: 
result_trans <- gg_translate(
  df = df_my,
  col_key = "index",
  col_trans = "target",
  ggkey = keyring::key_get("key",keyring = "gg-trans"))

## End(Not run)


huhuaping/xmerit documentation built on Nov. 10, 2023, 4:34 a.m.