knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
This package provides functions to:
You can install weblatetools from GitHub with:
# install.packages("devtools") devtools::install_github("GreenpeaceSchweiz/weblatetools")
The following example shows how to copy translations for the language "lang" from a project "A" to a project "B", while filtering some translations and replacing some strings.
library(weblatetools) # copyTranslations() stores the translation files and creates log files. # Choose an appropriate working directory. setwd("~/myproject") # Initialize some base parameters. "to.project" is set here instead of in # copyTranslations() or postFile() to avoid mistakenly writing to the wrong # project. setup(api.url = "https://example.com", token = readLines("token.txt"), to.project = "B") # Working with the components from the destination project is recommended. # If, during the copy process, you try to get a component that does not exist in # the source project, it will simply be skipped. components <- getComponents("B") copyTranslations(components = components$slugs, to.language = "lang", from.project = "A", from.language = "lang", filter = "filter this translation", replace = as.data.frame(cbind(pattern = c("replace me"), replace = c("with this"))), verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.