Skip to contents

Create a get_text() Function

Usage

create_text_getter(raw_strings = NULL, FUN = NULL)

Arguments

raw_strings

list of string definitions (key = value) pairs

FUN

function to be called to get the string definitions

Value

a function that can be used to lookup the string constant(s)

Examples

get_text <- create_text_getter(
  list(hello_en = "good morning", hello_de = "sch<oe>ne Gr<ue><ss>e")
)

get_text("hello_en")
#> [1] "good morning"
get_text("hello_de")
#> [1] "schöne Grüße"
#get_text("no_such_key") # error with clear error message