Translates help documentation to another language

lang_help

Description

Translates a given topic into a target language. It uses the lang argument to determine which language to translate to. If not passed, this function will look for a target language in the LANG and LANGUAGE environment variables, or if something has been passed to the .lang argument in lang_use(), to determine the target language. If the target language is English, no translation will be processed, so the help returned will be the original package’s documentation.

Usage

lang_help(topic, package = NULL, lang = NULL, type = getOption("help_type"))

Arguments

Arguments Description
topic A character vector of the topic to search for.
package The R package to look for the topic, if not provided the function will attempt to find the topic based on the loaded packages.
lang A character vector language to translate the topic to
type Produce “html” or “text” output for the help. It defaults to getOption("help_type")

Value

Original or translated version of the help documentation in the output type specified

Examples



library(lang)

lang_use("ollama", "llama3.2", seed = 100)
#> Model: llama3.2 via Ollama
#> Lang: en_US.UTF-8

lang_help("lang_help", lang = "spanish", type = "text")
#> ✔ lang - Translation complete
#> _D_o_c_u_m_e_n_t_a_c_i_ó_n _d_e _a_y_u_d_a _p_a_r_a _t_r_a_d_u_c_i_r _a _o_t_r_o _i_d_i_o_m_a.
#> 
#> _D_e_s_c_r_i_p_t_i_o_n:
#> 
#>      Traduce un tema dado a una lengua objetivo. Utiliza el argumento
#>      'lang' para determinar la que traducir. Si no se pasa, esta
#>      función buscará una lengua objetivo en las variables de entorno
#>      LANG y LANGUAGE, o si algo ha sido pasado al argumento '.lang' en
#>      'lang_use()', para determinar la lengua objetivo. Si la lengua
#>      objetivo es inglés, no se procesará la traducción, por lo que el
#>      ayuda devuelto será la documentación original del paquete.
#> 
#> _U_s_a_g_e:
#> 
#>      lang_help(topic, package = NULL, lang = NULL, type = getOption("help_type"))
#>      
#> _A_r_g_u_m_e_n_t_s:
#> 
#>    topic: vector de carácter del tema a buscar.
#> 
#>  package: El paquete R para buscar el tema, si no se proporciona la
#>           función intentará encontrar el tema basado en los paquetes
#>           cargados.
#> 
#>     lang: La cadena de caracteres del lenguaje para traducir el tema a
#> 
#>     type: Producir "html" o "text" como salida para la ayuda. Se
#>           establece por defecto en 'getOption("help_type")'.
#> 
#> _V_a_l_u_e:
#> 
#>      Versión del documento de ayuda en el tipo de salida especificado
#> 
#> _E_x_a_m_p_l_e_s:
#> 
#>      library(lang)
#>      
#>      lang_use("ollama", "llama3.2", seed = 100)
#>      
#>      lang_help("lang_help", lang = "spanish", type = "text")
#>