copyTranslations: Copy and edit translation files

View source: R/copyTranslations.R

copyTranslationsR Documentation

Copy and edit translation files

Description

Download translation files for a Weblate project, edit them and then reupload them to the same or a different Weblate project.

Usage

copyTranslations(
  components,
  to.language,
  from.project,
  from.language,
  conflict = "ignore",
  verbose = FALSE,
  download = TRUE,
  download.method = "api",
  upload = TRUE,
  editFunction = editTranslationFile,
  ...
)

Arguments

components

A list of component names (slugs).

to.language

The language to copy to.

from.project

The project to copy from.

from.language

The language to copy from.

conflict

Optional. How to handle conflicts on the server. One of "ignore", "replace-translated" or "replace-approved".

verbose

Optional. Whether to print a detailed log to the console or not.

download

Optional. Whether to download translation files (uses files on disk if FALSE).

download.method

Optional. Which method to use to download the translation files. See getFile.

upload

Optional. Whether to upload translation files after download (and editing).

editFunction

Optional. The function to edit the translation files. Defaults to editTranslationFile. Needs to have at least the parameters "slug" and "from.language", save processed files as "slug-i.csv" (with i in 1:n) and return n the number of created files. During upload, all of processed files will be uploaded.

...

Parameters to be passed to the editFunction. See editTranslationFile

Value

Count of accepted new translations in the destination project.

Examples

## Not run: 
updateCount <- copyTranslations(components = "address",
                                to.language = "de_CH",
                                from.project = "gpde",
                                from.language = "de",
                                filter = "Deutschland",
                                replace = as.data.frame(cbind(pattern = c("ß"),
                                                              replace = c("ss"))))

## End(Not run)

GreenpeaceSchweiz/weblatetools documentation built on Nov. 21, 2022, 1:21 p.m.