Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Feature/all translations in spreadsheet with generator macro #59

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ You just need to click on [this link](https://discord.com/oauth2/authorize?clien

You can add languages to the robot so that it is translated and accessible to everyone!

To do this, nothing could be simpler, just copy the file `./app/lang/en.js` then rename it following the [ISO 639-1 nomenclature](http://www.mathguide.de/info/tools/languagecode.html).
Then you just need to modify the file as you wish. For the translation to be set up on the robot, do not hesitate to open a pull request by [following this guide](https://github.com/LucasCtrl/spookyBot/blob/main/README.md#-contributing).

To react to a word, you need two elements in the translation file: the word and the emoji with which it will react.

```json
{
"name": "halloween",
"emoji": "🎃"
}
```
To do this:
1. Open the file, e.g. with LibreOffice: `./app/lang/generated/all_translations_and_file_generator.ods`
1. Navigate to the sheet `Emojis and all languages` and please enhance it with more words or the language or emoji that you want to add and stick to the format of other entries (do not use capital letters) with the single quotes and separating different word (combinations) with a comma, e.g.:
* For a single trigger word: 'alien‘
* For a single trigger word which consists of two words: 'black cat‘
* Or for more than one word: 'alienmonster', 'monster'
1. Navigate to the sheet `Document history` and add a row in which you shortly in English describe the changes that you have made in the style of the former entries. E.g.
* For a new languages: `Added words for language zh (Chinese).`
* Or for just adding words in an existing language: `Added more words to language en (English)`.
1. Save the spreadsheet file.
1. Navigate to the sheet `HowTo` and generate the new or updated language files (*.js, e.g. “en.js“, “es.js“ or “fr.js“, …) in the directory of this spreadsheet file by clicking on the button `Create language files *.js` that calls a Basic macro which is generating the relevant JavaScript language files for the emojis.
* *Hint:* If the button is not clickable you probably need to change the mode in which LibreOffice is:
* In the menu bar click on “Extras“ → “Formulars“ → “Draft mode“
1. Move the newly generated *.js file, e.g. "it.js", into the parent folder `./app/lang/`
1. Via git add the new *.js file, e.g. "it.js" in folder `./app/lang/` and also add the changes in the `./app/lang/generated/all_translations_and_file_generator.ods` file to your git feature branch and commit (+ push) it.
1. For the translation to be set up on the robot, do not hesitate to open a pull request by [following this guide](https://github.com/LucasCtrl/spookyBot/blob/main/README.md#-contributing).

You can see that the `emoji` element is an emoji, but you can also use a custom emoji. For that, I strongly advise you to [read this guide](https://discordjs.guide/popular-topics/reactions.html#custom-emojis).

Expand Down
12 changes: 6 additions & 6 deletions app/lang/ar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ module.exports = {
words: [
{
// Please do not delete this one 🙏
name: 'مرعب',
name: ['مرعب'],
emoji: '761602615326146590',
},
{
name: ['حلوى', 'حلويات'],
emoji: '🍬',
},
{
name: 'شبح',
name: ['شبح'],
emoji: '👻',
},
{
name: 'عيد الرعب',
name: ['عيد الرعب'],
emoji: '🎃',
},
{
name: 'مصاص دماء',
name: ['مصاص دماء'],
emoji: '🧛🏻‍♂️',
},
{
name: 'ساحر',
name: ['ساحر'],
emoji: '🧙',
},
{
name: 'الاموات الاحياء',
name: ['الاموات الاحياء'],
emoji: '🧟',
},
],
Expand Down
12 changes: 6 additions & 6 deletions app/lang/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ module.exports = {
words: [
{
// Please do not delete this one 🙏
name: 'spooky',
name: ['spooky'],
emoji: '761602615326146590',
},
{
name: ['caramel', 'dolç'],
emoji: '🍬',
},
{
name: 'fantasma',
name: ['fantasma'],
emoji: '👻',
},
{
name: 'halloween',
name: ['halloween'],
emoji: '🎃',
},
{
name: 'vampir',
name: ['vampir'],
emoji: '🧛🏻‍♂️',
},
{
name: 'mag',
name: ['mag'],
emoji: '🧙',
},
{
name: 'zombie',
name: ['zombie'],
emoji: '🧟',
},
],
Expand Down
16 changes: 8 additions & 8 deletions app/lang/el.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ module.exports = {
words: [
{
// Please do not delete this one 🙏
name: 'spooky',
name: ['spooky'],
emoji: '761602615326146590',
},
{
name: 'Καραμέλα',
name: ['Καραμέλα'],
emoji: '🍬',
},
{
name: 'Φάντασμα',
name: ['Φάντασμα'],
emoji: '👻',
},
{
name: 'Απόκριες',
name: ['Απόκριες'],
emoji: '🎃',
},
{
name: 'Βρυκόλακας',
name: ['Βρυκόλακας'],
emoji: '🧛🏻‍♂️',
},
{
name: 'Μάγισσα',
name: ['Μάγισσα'],
emoji: '🧙',
},
{
name: 'Ζόμπι',
name: ['Ζόμπι'],
emoji: '🧟',
},
{
name: 'Ιστός',
name: ['Ιστός'],
emoji: '🕸',
},
],
Expand Down
2 changes: 1 addition & 1 deletion app/lang/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
words: [
{
// Please do not delete this one 🙏
name: 'spooky',
name: ['spooky'],
emoji: '761602615326146590',
},
{
Expand Down
34 changes: 34 additions & 0 deletions app/lang/generated/Minimalist_approach/ar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
lang: 'ar', // Arabic
words: [
{
// Please do not delete this one 🙏
name: ['مرعب'],
emoji: '761602615326146590',
},
{
name: ['حلوى', 'حلويات'],
emoji: '🍬',
},
{
name: ['شبح'],
emoji: '👻',
},
{
name: ['عيد الرعب'],
emoji: '🎃',
},
{
name: ['ساحر'],
emoji: '🧙',
},
{
name: ['مصاص دماء'],
emoji: '🧛',
},
{
name: ['الاموات الاحياء'],
emoji: '🧟',
}
]
}
34 changes: 34 additions & 0 deletions app/lang/generated/Minimalist_approach/ca.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
lang: 'ca', // Catalan
words: [
{
// Please do not delete this one 🙏
name: ['spooky'],
emoji: '761602615326146590',
},
{
name: ['caramel', 'dolç'],
emoji: '🍬',
},
{
name: ['fantasma'],
emoji: '👻',
},
{
name: ['halloween'],
emoji: '🎃',
},
{
name: ['mag'],
emoji: '🧙',
},
{
name: ['vampir'],
emoji: '🧛',
},
{
name: ['zombie'],
emoji: '🧟',
}
]
}
Loading