ropensci / tinkr

Convert (R)Markdown files to XML, edit them, write them back as (R)Markdown
https://docs.ropensci.org/tinkr
GNU General Public License v3.0
57 stars 3 forks source link

math on the other side #124

Closed maelle closed 2 weeks ago

maelle commented 1 month ago

In French we put the currency after the numbers. Now, the example that does not work has wrong punctuation but still, might be worth a note in the docs?

Sys.setenv(DEEPL_API_KEY = keyring::key_get("deepl"))

# works
babeldown::deepl_translate_markdown_string(
  "Plein de sous: $100",
  source_lang = "fr",
  target_lang = "EN-US"
)
#> [1] "Lots of money: $100"

# works
babeldown::deepl_translate_markdown_string(
  "Plein de sous: 100$!",
  source_lang = "fr",
  target_lang = "EN-US"
)
#> [1] "Lots of money: 100$!"

# doesn't work
babeldown::deepl_translate_markdown_string(
  "Plein de sous: 100$",
  source_lang = "fr",
  target_lang = "EN-US"
)
#> Error in `purrr::map()`:
#> ℹ In index: 1.
#> ℹ With name: 1.
#> Caused by error:
#> ! Inline math delimiters are not balanced.
#> 
#> HINT: If you are writing BASIC code, make sure you wrap variable
#>       names and code in backtics like so: `INKEY$`.
#> 
#> Below are the pairs that were found:
#> start...end
#> -----...---
#>      ...Plein de sous: 100$

Created on 2024-10-18 with reprex v2.1.0

zkamvar commented 1 month ago

In French we put the currency after the numbers.

This is why international collaboration is important! I did not know this! We might be able to apply the same sort of rule as in #122 and maybe even apply the zipper in #123 in the reverse order to clean up.

maelle commented 1 month ago

I also read that in French we need to put a space before the $ but I had no idea so am not sure it's widespread.