matt-dray / r2eng

:speaking_head::speaker: R package: translate R to English
https://matt-dray.github.io/r2eng/
Other
17 stars 5 forks source link

Allow custom translations #29

Open matt-dray opened 1 year ago

matt-dray commented 1 year ago

Maybe a user could provide a list object with preferred text for each token?

Something like:

r2eng::translate("1 / 1", dict = list("/" = "divided by")))  # rather than 'over'

It's probably preferable for this to be set as an option() so that it can always be applied when the function is called in a given session.

mattkerlogue commented 1 year ago

Option sets the location of a “dictionary” file that’s set out in YAML?

matt-dray commented 1 year ago

@mattkerlogue Ahaha, didn't realise you watched this repo. I was just thinking about tidying up this package soon—especially #10, #14 and #28—and then maybe even release a v0.1 eventually. (P.S. y r u such a YAML fanboi 🙃)

mattkerlogue commented 1 year ago

Ahahah. Well it could specify a list or a YAML file, which the {yaml} package reads in as a list. Reason for thinking of a file was so that ’translations’ could be shared, e.g an “en-GB”, “en-US”, “en-CA”, “en-AU”, “en-pirate”.