Method new()
Initialize the Translator with data
Usage
Translator$new(
translation_csvs_path = NULL,
translation_json_path = NULL,
translation_csv_config = NULL,
separator_csv = ",",
automatic = FALSE
)
Arguments
translation_csvs_path
character with path to folder containing csv
translation files. Files must have "translation_" prefix, for example:
translation_<LANG-CODE>.csv
.
translation_json_path
character with path to JSON translation file.
See more in Details.
translation_csv_config
character with path to configuration file for
csv option.
separator_csv
separator of CSV values (default ",")
automatic
logical flag, indicating if i18n should use an automatic
translation API.
Method get_languages()
Get all available languages
Usage
Translator$get_languages()
Method get_translations()
Get whole translation matrix
Usage
Translator$get_translations()
Method get_key_translation()
Get active key translation
Usage
Translator$get_key_translation()
Method translate()
Translates 'keyword' to language specified by 'set_translation_language'
Usage
Translator$translate(keyword, session = shiny::getDefaultReactiveDomain())
Arguments
keyword
character or vector of characters with a word or
expression to translate
session
Shiny server session (default: current reactive domain)
Method t()
Wrapper to translate
method.
Usage
Translator$t(keyword, session = shiny::getDefaultReactiveDomain())
Arguments
keyword
character or vector of characters with a word or
expression to translate
session
Shiny server session (default: current reactive domain)
Method set_translation_language()
Specify language of translation. It must exist in 'languages' field.
Usage
Translator$set_translation_language(transl_language)
Arguments
transl_language
character with a translation language code
Method parse_date()
Parse date to format described in 'cultural_date_format' field in config.
Usage
Translator$parse_date(date)
Arguments
date
date object to format
Method parse_number()
Numbers parser. Not implemented yet.
Usage
Translator$parse_number(number)
Arguments
number
numeric or character with number
Returns
character with number formatting
Method automatic_translate()
Translates 'keyword' to language specified by 'set_translation_language'
using cloud service 'api'. You need to set API settings first.
Usage
Translator$automatic_translate(keyword, api = "google")
Arguments
keyword
character or vector of characters with a word or
expression to translate
api
character with the name of the API you want to use. Currently
supported: google
.
Method at()
Wrapper to automatic_translate
method
Usage
Translator$at(keyword, api = "google")
Arguments
keyword
character or vector of characters with a word or
expression to translate
api
character with the name of the API you want to use. Currently
supported: google
.
Method use_js()
Call to wrap translation in span object. Used for browser-side translations.
Usage
Translator$use_js()
Method clone()
The objects of this class are cloneable with this method.
Usage
Translator$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.