retextjs/retext-simplify

How to add a new language?

s-a opened this issue · 6 comments

s-a commented

Hi,
it might be cool to add a "how to add a new language" to the retext plugins. Does a decorated "awesome retext" list anywhere 😃 ?

Good idea! For now, just the README of retext contains information.

For other languages, I suggest cloning this repo, trashing .git, replacing all instances of simplify with another name (possibly suffixed by a language code? e.g., retext-simplify-nl for dutch), and changing the data!

s-a commented

I would suggest to a add a setLanguage() methode and rename /data/index.json to /data/EN-gb.json and use this as fallback if the given language does not exist. If we clone plugin repos we cannot benefit from improvements authors make in their codes.

s-a commented

Maybe this issue might be more addressed to the https://github.com/wooorm/retext constructor where the plugins could ask for the current language?

I’d rather not build that into retext, it’s not as easy as just specifying languages because sentences and paragraphs can contain multiple languages. It’s not very easy.

And, another problem is the size of packages: my preference is to keep the size low. retext-simplify is 18KB, of which around 17KB is the database. If I were to add other languages, those would significantly increase the size for the English language, and for the other languages themselves.

An alternative would be to publish different packages from one (this) repository. That could also work.

But, for now this is all theoretical; are you in fact considering creating patterns for other languages?

s-a commented

I’d rather not build that into retext, it’s not as easy as just specifying languages because sentences and paragraphs can contain multiple languages. It’s not very easy.

Yes this is true.

And, another problem is the size of packages: my preference is to keep the size low. retext-simplify is 18KB, of which around 17KB is the database. If I were to add other languages, those would significantly increase the size for the English language, and for the other languages themselves.

Well for example Moment.js ships different locales and let the developer decide what they want to deploy in their packages. https://github.com/moment/moment/tree/develop/locale

are you in fact considering creating patterns for other languages?

Yes I think about to write some text author helping tools for german language. Watching retext for some time and the last missing element was a spelling checker 😄

Well for example Moment.js ships different [...]

Difference being that moment users (often) need multiple locales at the same time, plus that the localisation is quite small.

Yes I think about to write some text author helping tools for german language [...]

Cool! 👍 Also check out parse-dutch, you’ll probably want to create something like that, for German, too!

For now, I’d say we wait until there are actual translations, before making a decision.