retextjs/retext-equality

Spanish Translation Integration

MrBenJ opened this issue · 6 comments

I need some help on where to get started with integrating the Spanish wordlist from words/cuss. If anyone has a hint or idea of where to get started, that would be greatly appreciated :)

@MrBenJ Thanks for opening this! I appreciate it! 👍

The words from words/cuss can go in retext-profanities! See retextjs/retext-profanities#10 for some more info. What we need there is something to split the current index.js into a factory.js (or so), and an en.js (or maybe just index.js) that uses factory to create a file for English. So all the logic should go in factory.js, and it should expose a function that’s given the English cuss results.

For this plugin (retext-equality), I suggest doing something similar, but we still need phrases in other languages!

In retext-profanities we now have a factory that kind of does what I envisioned here for i18n as well, e.g., by Spanish like so. But it’s just an example, so the implementation here would be different!

I looked at retext-profanities and saw the approach from there with factory.js. Is that kind of approach what you're looking for in this repo?

@MrBenJ Yeah, I believe so. Something like that makes the most sense to me?
retext-equality is a bit different because it has all the patterns itself, in YAML files, so we also need to support building multiple languages though.

I rewrote the library to support other languages! To add a new language:

  1. Create a new directory data/es/ (in this case es because it’s the BCP 47 tag for Spanish)
  2. Add some patterns!
  3. npm test should generate the rest 🦄

I’ll close this here now because I think the next step is for someone to create a PR adding a language.