 Hello everyone, my name is Juan Paolo and I'm going to talk to you about internationalization for shiny apps So I figured maybe we could get some help from Carl since he has a mustache and apparently he speaks Italian but unfortunately It didn't work out. Sorry Carl Just because you have a mustache, it doesn't mean you can speak Italian So is there anything we can do to speak other languages while using R? Yes, there is and I'm gonna Talk to you about it in this talk See here a Function to say hello in different languages. So that's the first step to introduce internationalization Why do I care about it? Basically a few years back. It wanted to build Interactive map of the world and unfortunately a lot of the documentation code snippets Even the databases were in English. So it was a bit difficult for me and It took longer than expected to build this map So it's important if we talk about language as way to make our tools more inclusive as Most of us don't speak English as a first language and we have seen now with the corona virus that global issues require That we are prepared to communicate the data better especially in different languages and We should try to do that with less effort So I do really care about making data science more accessible and Especially building tools that are useful for non coders. That's why we started working on internationalization of data apps So How did we start we basically look at how it works in other languages and My case I got inspiration from Node.js And got some implementation ideas like the easiest way to make some Translation of keywords is just using a dictionary for UI terms we want to focus on translating common terms for data science and I started the first the first version of this by downloading Genome translations for different languages then maybe we can use also YAML to Allow users to implement their own custom translations So Yeah, the world the word internationalization has 18 characters between the I and the N Can we squeeze that into shiny? Yes, we can and that's Why the name of the package is like this To be read shiny internationalization Cool, so let's get started. Let's install the package It's on github There's a web page with the code Shiny internationalization that data sketch that depth and there's a link to our github So before we begin Are it really 18 characters between the I and the N? I counted it many times. I wasn't sure I was doing it, right? So I wrote a small program and Indeed it has 18 characters Crazy, isn't it? Cool, let's start with our first app with internationalization So the here on the right you see a small app that basically translate different terms Hello world in different languages This is the structure for the app of a regular shiny app and that we gonna introduce Some things that are needed to make the translations work First Load some code in the UI using use shiny internationalization Then we can introduce a language a language switcher Then we define our regular UI elements either as Strings in the UI as we usually do but we grab them in this function UI underscore or we put our regular UI output as We do to get things from the server Then in the on the server side we configure our languages See here we can Define a default language and the available languages we want to use then we have a module a shiny module that allows us to Get the currently active language that we will use to make the translations Then We just Output our app as we usually do and now we grab everything in the I function I showed you in the beginning Making sure that we pass the the active language As a parameter, so it knows what language to translate the strings to and here is the full working app just hello world and Our language Good, so what else we can do with this the I underscore function is the basis of everything We use it mostly in the server Make sure as I mentioned to use the UI underscoring the UI Here you see an example. I underscore select the for German and we get Ausweilen then the function also works with vectors so we can pass vectors of keywords and It also works with the lists In here, we can also set which keys to translate So when we have a list with multiple items, we can define specifically which keywords to do which keys from the list to translate and It also works with the reactives and modules within shiny apps Now let's look at the configuration We saw already the default language the available language we want to have in the app Now We can define a local directory which is basically where we gonna store our custom Keyword translation Then we can define some fallbacks, which is basically where we are gonna Define if a translation is not found Where it should look for so for instance, maybe we don't have a specific translation for a word in Portuguese we could Make it fall back to Spanish and the query Panameter when we want to set the the language through URL Here with you currently have 15 Available languages which we can see right here and Now let's talk about how to introduce custom translations. All you have to do is create a local directory In which we're gonna store some YAML files Where we will introduce some keywords and The current translation so for instance you see here the S that YAML as for Spanish and We have my slang How are you como estás if we use this in the I underscore function? then we can Pass the my slang that how are you to navigate through these nested YAML and Finally, we get our result We can also set the default language by URL parameter In here if we use show select to repulse falls. We don't get the selector, but we cannot always use the language for Spanish in this case to load the app with the pretty fine language Now we can look at the More at the more complex day at data app with translation. We have different modules and You see here. It is an English. We can change different values We see all the UI elements transformed even those Including the options right here We change into Spanish and we see all The different texts from the UI elements Selectors everything translated into Spanish You may see that this doesn't look exactly like a shiny app It's because we're using another of my packages. It's called shiny panels if you want to give it a try Cool. So what's next? We want to give the possibility to invent your own language so far. We work only with predefined languages This might be useful not only for Klingon, but to introduce more Other languages that are not well documented like indigenous languages Question will it make it to cram it will make it but not in this shape because I realized that the Translation functionality is not only useful for shiny apps, but also for any types of reports visualizations so It will make it to quite to cram was we once we split the functionality so it works with different types of content Like you know, maybe Change look at adjusting locales and number formatting. It's something that we want to introduce later Cool. So just get involved help us Make some memes like the ones you see right here using keyword translations Please submit some issues or pull requests and help us with the custom translations and of course adding new languages it all comes Just to adding new columns or a rows to these UI translations CSV file, which is in the repository and We can get more keywords specially for data science and more languages So thank you so much. I really hope you enjoy it and help us improve the package. Bye. Bye