Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Appsilon/shiny.i18n
Shiny applications internationalization made easy
https://github.com/Appsilon/shiny.i18n
cran internationalization language r rhinoverse shiny translation
Last synced: about 2 months ago
JSON representation
Shiny applications internationalization made easy
- Host: GitHub
- URL: https://github.com/Appsilon/shiny.i18n
- Owner: Appsilon
- License: other
- Created: 2017-08-03T13:47:37.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T11:12:53.000Z (2 months ago)
- Last Synced: 2024-07-19T15:12:14.290Z (2 months ago)
- Topics: cran, internationalization, language, r, rhinoverse, shiny, translation
- Language: R
- Homepage: https://appsilon.github.io/shiny.i18n/
- Size: 3.75 MB
- Stars: 168
- Watchers: 31
- Forks: 38
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - shiny.i18n - Easy internationalization of Shiny apps. (UI Components / i18n)
- jimsghstars - Appsilon/shiny.i18n - Shiny applications internationalization made easy (R)
README
> _Shiny applications internationalization made easy!_
[![CRAN status](https://www.r-pkg.org/badges/version/shiny.i18n)](https://cran.r-project.org/package=shiny.i18n)
[![codecov](https://codecov.io/gh/Appsilon/shiny.i18n/branch/main/graph/badge.svg)](https://app.codecov.io/gh/Appsilon/shiny.i18n/)
[![cranlogs](https://cranlogs.r-pkg.org/badges/shiny.i18n)](https://CRAN.R-project.org/package=shiny.i18n)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/shiny.i18n)](https://CRAN.R-project.org/package=shiny.i18n)
[![R-CMD-check](https://github.com/Appsilon/shiny.i18n/workflows/R-CMD-check/badge.svg)](https://github.com/Appsilon/shiny.i18n/actions/workflows/main.yaml)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 readable.
*Actually, you can use **shiny.i18n** as a standalone R package - shiny app is just a perfect use-case example.*
Change languages and formats easy with **shiny.i18n**.
## How to install?
Stable version:
```r
install.packages("shiny.i18n")
```Development version:
```r
remotes::install_github("Appsilon/shiny.i18n")
```## Examples
See shiny.i18n in action liveYou can find some basic examples in `examples` folder:
1) Using i18n object with [CSV translation files](https://github.com/Appsilon/shiny.i18n/blob/master/examples/basic/app_csv.R) or [JSON translation files](https://github.com/Appsilon/shiny.i18n/blob/master/examples/basic/app_json.R).
2) Live language change on the [browser side](https://github.com/Appsilon/shiny.i18n/blob/master/examples/live_language_change/browser_app.R) or with the server [function renderUI](https://github.com/Appsilon/shiny.i18n/blob/master/examples/live_language_change/server_app.R).
3) [RMarkdown translations](https://github.com/Appsilon/shiny.i18n/blob/master/examples/rmarkdown/report.Rmd).
4) Example of translation [data format](https://github.com/Appsilon/shiny.i18n/tree/master/examples/data).
5) **shiny.i18n** works seamlessly with [Quarto](https://github.com/Appsilon/shiny.i18n/tree/master/examples/quarto).
6) **shiny.i18n** also works when used in interactive [Quarto + Shiny instances](https://github.com/Appsilon/shiny.i18n/tree/master/examples/quarto_interactive). Alternatively, you can also experience a [deployed version](https://connect.appsilon.com/shinyi18n-quarto-interactive-example).
#### Translation file format
Currently **shiny.i18n** supports two translation formats:
- **csv** - where each translation is in separate file `translation_.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:
```r
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.
```r
Translator$new(translation_json_path = "...")
```## `shiny.i18n` and `rhino`
`shiny.i18n` can be used to add live language change feature to Shiny applications built using [Rhino framework](https://appsilon.github.io/rhino/).
For more details, check [this tutorial](https://appsilon.github.io/shiny.i18n/articles/rhino.html).## How to contribute?
If you want to contribute to this project please submit a regular PR, once you're done with a new feature or bug fix.
Reporting a bug is also helpful - please use [GitHub issues](https://github.com/Appsilon/shiny.i18n/issues) and describe your problem as detailed as possible.
## Appsilon
Appsilon is a **Posit (formerly RStudio) Full Service Certified Partner**.
Learn more at [appsilon.com](https://appsilon.com).Get in touch [[email protected]](mailto:[email protected])
Explore the [Rhinoverse](https://rhinoverse.dev) - a family of R packages built around [Rhino](https://appsilon.github.io/rhino/)!