Skip to contents

Creates translation function for named string list

Usage

gtl_translator(dictionary)

Arguments

dictionary

A list of translations

Value

A function that translates

Examples

translations <- list(
  "maison" = "house",
  "chapeau" = "hat",
  "chat" = "cat"
)

translate_to_english <- gtl_translator(translations)
translate_to_english("maison")
#> [1] "house"
translate_to_english("chat")
#> [1] "cat"