When you pass in a vector consisting of an English or Chinese words, this function will calls the Youdao translation open API for R to return the corresponding type of Chinese or English representation.

translate(x)

Arguments

x

A vector made up of English or Chinese words

Value

A vector made up of Chinese or English words

Examples


# Example-1
translate("apple")
#> [1] "苹果"

# Example-2
x <- c("apple", "banana", "pear", "I love you")
translate(x)
#> [1] "苹果"   "喷鼻蕉" "梨"     "我爱你"