Skip to content

Commit

Permalink
adding guide for adding languages
Browse files Browse the repository at this point in the history
  • Loading branch information
jaanonim committed Feb 6, 2024
1 parent 6c572f1 commit e72e442
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions Languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!**
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 🎉** <br>
Preview of verse after hover over the link.
Expand Down

0 comments on commit e72e442

Please sign in to comment.