Skip to content

Commit

Permalink
docs: improve key docs
Browse files Browse the repository at this point in the history
Fix #77
  • Loading branch information
maelle committed Dec 19, 2024
1 parent ddef825 commit 2a790a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
11 changes: 9 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,21 @@ The DeepL API URL depends on your API plan.
babeldown uses the DeepL _free_ API URL by default.
If you use a Pro plan, set the API URL via

```{r}
```{r, eval=FALSE}
Sys.setenv("DEEPL_API_URL" = "https://api.deepl.com")
```

### API key

Set your API key via the environment variable `DEEPL_API_KEY`.
You could store it with the [keyring](https://r-lib.github.io/keyring/index.html) package and retrieve it like so:

You could store it with the [keyring](https://r-lib.github.io/keyring/index.html) package, once per user/machine.

```r
keyring::key_set("deepl") # will prompt you to enter the key interactively
```

In any script you use babeldown, you'd retrieve the key like so:

```{r}
Sys.setenv(DEEPL_API_KEY = keyring::key_get("deepl"))
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ translate: Markdown strings
(`babeldown::deepl_translate_quarto()`) and Hugo blog posts
(`babeldown::deepl_translate_hugo()`) in particular.

With babeldown you can also _update_ translations, see `babeldown::deepl_update()`.
With babeldown you can also *update* translations, see
`babeldown::deepl_update()`.

## Installation and setup

Expand Down Expand Up @@ -48,9 +49,17 @@ Sys.setenv("DEEPL_API_URL" = "https://api.deepl.com")

### API key

Set your API key via the environment variable `DEEPL_API_KEY`. You could
store it with the [keyring](https://r-lib.github.io/keyring/index.html)
package and retrieve it like so:
Set your API key via the environment variable `DEEPL_API_KEY`.

You could store it with the
[keyring](https://r-lib.github.io/keyring/index.html) package, once per
user/machine.

``` r
keyring::key_set("deepl") # will prompt you to enter the key interactively
```

In any script you use babeldown, you’d retrieve the key like so:

``` r
Sys.setenv(DEEPL_API_KEY = keyring::key_get("deepl"))
Expand Down

0 comments on commit 2a790a5

Please sign in to comment.