Skip to contents

This function is a wrapper around translate_df(). It takes a dataset and creates and translates a data dictionary for it. It translates both the variable names and the value labels into one or more target languages.

Usage

translate_dict(
  dataset,
  source_lang = "en",
  target_lang = c("es", "fr", "pt"),
  translator = "wmcloud"
)

Arguments

dataset

The input data frame to generate a dictionary from.

source_lang

The source language of the data dictionary (default is "en").

target_lang

A character vector of target language codes - can pass multiple (e.g., c("es", "fr")).

translator

The translation service to use. Passed to translate_df(). Options are "wmcloud" (default), "deepl", and "gemini". Note that "deepl" uses babelquarto and "gemini" uses mall, both of these require an API token in your environment.

Value

A list containing two data frames: one for translated variable names and one for translated value labels.

Examples

if (FALSE) { # \dontrun{
translated_dictionary <- translate_dict(iris, target_lang = "es")
} # }