This PR refactors the translation mechanisms to be a bit more straightforward to manage in the future. I've used the guidance from the Internal State chapter of the R package book to inform the solution:
translation strings all live in R/utils-translate.R and are not duplicated
the source for the translation strings are stored in these$translations$src.
all translations are intialised by establish_translation_vars() when sandpaper is loaded
strings are translated to lesson language by set_language() when lesson is loaded
documentation has been updated.
I've also updated the documentation to automatically include a list of all translatable strings.
Note that this could serve as scaffolding for refactoring the other global variables to not be so painful to implement.
This PR refactors the translation mechanisms to be a bit more straightforward to manage in the future. I've used the guidance from the Internal State chapter of the R package book to inform the solution:
R/utils-translate.R
and are not duplicatedthese$translations$src
.establish_translation_vars()
when sandpaper is loadedset_language()
when lesson is loadedI've also updated the documentation to automatically include a list of all translatable strings.
Note that this could serve as scaffolding for refactoring the other global variables to not be so painful to implement.