diff --git a/Languages.md b/Languages.md index b0a1417..67877a2 100644 --- a/Languages.md +++ b/Languages.md @@ -9,3 +9,37 @@ Thanks to the community, we have support for the following languages: - German - [Tecur](https://github.com/Tecur) - Chinese - [John Huang](https://github.com/junwhuan) +## Adding new language support + +If you want to add support for a new language, you can do so by following these steps: + +1. Fork the repository. +2. Create a new file in `data/books` with the name of the language (e.g. `data/books/pl.json`) with books names. +3. Import json file to `src/Books.ts` as shown in the example: + +```ts +import _pl from "../data/books/pl.json"; +``` + +```ts +const pl = _pl as { + [key: string]: string[]; +}; +``` + +```ts +Object.keys(books).forEach((b) => { + books[b].push( + // ... + ...pl[b] + // ... + ); +}); +``` + +(See the other languages for examples.) + +4. Add your name to the list above in this file (`Languages.md`). +5. Create a PR with the changes. (I will review it and merge it.) + +**Thank you for your contribution!** diff --git a/README.md b/README.md index 666ec12..fda6e5f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ You need to just type for example: `@ John 1:1-6`. `@` char is a trigger for suggestion and it can be changed in settings. -I'm from Poland so plugin supports polish books names (eq. `J 1:1-6`, `Mt 24,1`). If you would like it to support your language books names feel free to make PR (you need to create json in `data/books` and add it in `src/Books.ts`). +I'm from Poland so plugin supports polish books names (eq. `J 1:1-6`, `Mt 24,1`). If you would like it to support your language books names read the guide in [Languages.md](./Languages.md). **New future 🎉**
Preview of verse after hover over the link.