Giter VIP home page Giter VIP logo

shiny.i18n's Introduction

We are hiring!

shiny.i18n

R-CMD-check codecov cranlogs total

Shiny applications internationalisation made easy!

Using it is very simple: just prepare your translation files in one of the supported formats, read them into your app using user-friendly shiny.i18n interface and surround your expressions to translate by a translator tag. Thanks to that your app will remain neat and readible.

Actually, you can use shiny.i18n as a standalone R package - shiny app is just a perfect usecase example.

Change languages and formats easy with shiny.i18n.

Source code

This library source code can be found on Appsilon Data Science's Github:
https://github.com/Appsilon/shiny.i18n/

How to install?

install.packages("shiny.i18n")

Or use devtools for the most recent version:

devtools::install_github("Appsilon/shiny.i18n")

Examples

You can find some basic examples in examples folder:

  1. Using i18n object with CSV translation files or JSON translation files.

  2. Live language change on the browser side or with the server function renderUI.

  3. RMarkdown translations.

  4. Example of translation data format.

Translation file format

Currently shiny.i18n supports two translation formats:

  • csv - where each translation is in separate file translation_<LANGUAGE-CODE>.csv containing two columns: key translation, language to which it needs to be translated. Example of translation_pl.csv for Polish language you may find here: inst/examples/data/translation_pl.csv. You load the data by passing the path to folder containing all the csv files:
Translator$new(translation_csvs_path = "...")
  • json - single json file translation.json with mandatory fields: "languages" with list of all language codes and "translation" with list of dictionaries assigning each translation to a language code. Example of such a json file for Polish language you may find here: inst/examples/data/translation.json. You load the data by passing the path to json file.
Translator$new(translation_json_path = "...")

How to contribute?

If you want to contribute to this project please submit a regular PR, once you're done with new feature or bug fix. Reporting a bug is also helpful - please use github issues and describe your problem as detailed as possible.

Changes in documentation

Documentation is rendered with pkgdown. Just run pkgdown::build_site() after editing documentation or README.md.

Troubleshooting

We used the latest versions of dependencies for this library, so please update your R environment before installation.

Future enhacements

  • Format numeric data
  • Support plural forms

Appsilon

Appsilon is the Full Service Certified RStudio Partner. Learn more at appsilon.com.

Get in touch [email protected]

shiny.i18n's People

Contributors

berkorbay avatar dokato avatar fractalpolarity avatar jey1401 avatar krystian8207 avatar krzyslom avatar marekrogala avatar przytu1 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.