MyNixOS website logo
Description

Translate Between Different Languages.

The goal of this package is to translate between different languages without any Google API authentication which is pain and you must pay for the key, This package is free and lightweight.

gtranslate

The goal of gtranslate is to translate between different languages without any Google API authentication which is pain and you must pay for the key, gtranslate is free and lightweight.

gtranslate is inspired by deep-translator package.

Installation

You can install the development version of gtranslate from GitHub with:

# install.packages("devtools")
devtools::install_github("mohamed-180/gtranslate")

Example

This is a basic example which shows you how to use the package:

library(gtranslate)

translate("How are you?", from = "auto", to = "ar")

#[1] "كيف حالك؟"

You can pass character vector as text argument

library(gtranslate)

txt <- c("What time is it?", "Go home!", "I'm 30 years old.")

translate(txt, from = "auto", to = "hi") # hi for hindi

#[1] "ये वक़्त क्या है?"   "घर जाओ!"        "मैं 30 साल का हूँ।"

You can also pass any list-like object

library(gtranslate)
library(stringr)

translate(fruit[1:5], to = 'de') # de for German

#[1] "Apfel"    "Aprikose" "Avocado"  "Banane"   "Paprika"

Codes for supported languages

You can use lang_codes list to get the codes of the available languages instead of abbreviations characters as follows

library(gtranslate)

translate("R is a beatiful language.", from = lang_codes$english, to = lang_codes$turkish)

#[1] "R güzel bir dildir."

Limitations

There are two limitations to gtranslate:

  • The number of characters which sends per query must not exceeds 5000 characters, so there is trim_str argument which TRUE by default to trim the string to less than 5000 characters, You can put it to FALSE but you must handle the error your self by using tryCatch, split the long string or any other appropriate way.

  • According to google, you are allowed to make 5 requests per second, and up to 200k requests per day.

Metadata

Version

0.0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows