Skip to contents

Re-use existing translation where possible (at the node level: paragraph, heading, etc.)

Usage

deepl_update(
  path,
  out_path,
  yaml_fields = c("title", "description"),
  glossary_name = NULL,
  source_lang = NULL,
  target_lang = NULL,
  formality = c("default", "more", "less", "prefer_more", "prefer_less")
)

Arguments

path

Path to the Markdown file to be translated (character).

out_path

Path where the new translated file should be saved (character).

yaml_fields

Vector of character names of YAML fields to translate.

glossary_name

Name of the glossary to be used, if any (character).

source_lang

Name or code of source language. See DeepL docs.

target_lang

Name or code of source language. See DeepL docs.

formality

Formality level to use (character), one of

  • "default" (default)

  • "less" -- for a more informal language

  • "prefer_more" -- for a more formal language if available, otherwise fallback to default formality

  • "prefer_less" -- for a more informal language if available, otherwise fallback to default formality

Value

None

Details

The function looks for the latest commit that updated the source file, and for the latest commit that updated the target file. If the target file was updated later than the source file, or at the same time, nothing happens: you might need to reorder the Git history with rebase for instance.