{r include=FALSE}
+
+library(shiny.i18n)
+
+i18n <- Translator$new(translation_json_path = "translation.json")
+
+get_translation <- function(translator_object, language_code, content_key) {
+ translator_object$set_translation_language(language_code)
+ translator_object$t(content_key)
+}
Now, to include the language name as well as the method, we use
something like this.
-## `r { get_translation(i18n, "en", "language_name") }`
-
-`r { get_translation(i18n, "en", "method") }`
+## `r { get_translation(i18n, "en", "language_name") }`
+
+`r { get_translation(i18n, "en", "method") }`
This sets up an H2 Heading as well as the text that follows it. Here,
we are setting it up for English. For all languages, it would look
something like this.
- ## `r { get_translation(i18n, "en", "language_name") }`
-
-`r { get_translation(i18n, "en", "method") }`
-
-## `r { get_translation(i18n, "es", "language_name") }`
-
-`r { get_translation(i18n, "es", "method") }`
-
-## `r { get_translation(i18n, "fr", "language_name") }`
-
-`r { get_translation(i18n, "fr", "method") }`
-
-## `r { get_translation(i18n, "de", "language_name") }`
-
-`r { get_translation(i18n, "de", "method") }`
-
-## `r { get_translation(i18n, "it", "language_name") }`
-
-`r { get_translation(i18n, "it", "method") }`
-
-## `r { get_translation(i18n, "zh", "language_name") }`
-
-`r { get_translation(i18n, "zh", "method") }`
-
-## `r { get_translation(i18n, "ja", "language_name") }`
-
-`r { get_translation(i18n, "ja", "method") }`
-
-## `r { get_translation(i18n, "ko", "language_name") }`
-
-`r { get_translation(i18n, "ko", "method") }`
-
-## `r { get_translation(i18n, "pl", "language_name") }`
-
-`r { get_translation(i18n, "pl", "method") }`
-
-## `r { get_translation(i18n, "hi", "language_name") }`
-
-`r { get_translation(i18n, "hi", "method") }`
+ ## `r { get_translation(i18n, "en", "language_name") }`
+
+`r { get_translation(i18n, "en", "method") }`
+
+## `r { get_translation(i18n, "es", "language_name") }`
+
+`r { get_translation(i18n, "es", "method") }`
+
+## `r { get_translation(i18n, "fr", "language_name") }`
+
+`r { get_translation(i18n, "fr", "method") }`
+
+## `r { get_translation(i18n, "de", "language_name") }`
+
+`r { get_translation(i18n, "de", "method") }`
+
+## `r { get_translation(i18n, "it", "language_name") }`
+
+`r { get_translation(i18n, "it", "method") }`
+
+## `r { get_translation(i18n, "zh", "language_name") }`
+
+`r { get_translation(i18n, "zh", "method") }`
+
+## `r { get_translation(i18n, "ja", "language_name") }`
+
+`r { get_translation(i18n, "ja", "method") }`
+
+## `r { get_translation(i18n, "ko", "language_name") }`
+
+`r { get_translation(i18n, "ko", "method") }`
+
+## `r { get_translation(i18n, "pl", "language_name") }`
+
+`r { get_translation(i18n, "pl", "method") }`
+
+## `r { get_translation(i18n, "hi", "language_name") }`
+
+`r { get_translation(i18n, "hi", "method") }`
## Get Scrambling
-
-This little guide was a demonstration of how you can use `shiny.i18n` with Quarto to create a document in multiple languages. And what's more, you now know how to scramble eggs! You can view the full tutorial [here](https://appsilon.github.io/shiny.i18n/articles/quarto.html)
+## Get Scrambling
+
+This little guide was a demonstration of how you can use `shiny.i18n` with Quarto to create a document in multiple languages. And what's more, you now know how to scramble eggs! You can view the full tutorial [here](https://appsilon.github.io/shiny.i18n/articles/quarto.html)