Appsilon / shiny.i18n

Shiny applications internationalization made easy
https://appsilon.github.io/shiny.i18n/
Other
169 stars 38 forks source link

Feature request: Build .json skeleton from app.R #37

Closed mcsiple closed 4 years ago

mcsiple commented 4 years ago

Hi Appsilon folks! First of all, thank you for making this awesome package. I'm currently using it and it's making my life SO much easier!

One thing that would be really convenient for larger apps would be a function that builds a .json file based on the text labels in a shiny app. I am plugging away but find myself typing a lot of {"en": "", "es": ""} by hand in translation.json.

One way to do this might be for everything wrapped in i18n$t() within the Shiny app file to be automatically exported to a .json file with the "en" (or other default language) text already populated. I'm imagining a function that takes an app.R file, the languages the user will use in the translation, and writes a .json file to which you could add the translated text.

dokato commented 4 years ago

That's a good idea 👍 I'm addding it to the roadmap, thanks for suggestion @mcsiple .

BTW expect soon some major update, where we improve the way live language translation works - in a way that you don't need to rerender all UI elements on the server side everytime, which migth slow down the app.

mcsiple commented 4 years ago

Ooh, I'm looking forward to that! Currently trying to live-translate a semi-complicated app and had to change the structure of it to having the uiOutput() wrapper around all my output elements. if I didn't have to make a renderUI() object I think this would be a little easier. Thanks for the quick response and eager to see what comes next ✨

dokato commented 4 years ago

Hey @mcsiple in the latest version we added this function create_translation_file.

There's also a little addin that will make most of the work for you as long as you're using i18n name for your Translator object, see https://appsilon.github.io/shiny.i18n/articles/translation_format.html#addin-1

Currently just on github, soon on CRAN ;)