-
Notifications
You must be signed in to change notification settings - Fork 112
Translating
You want to translate Tillerinobot? Awesome! Now, you might want to first take a look at this page to check that your language isn't already translated. Another way is to type !set language somethingrandom
over at Tillerino to get a list of languages, but that might not show the most recent updates and won't show which languages are incomplete. Also, you probably want to double-check that your language isn't already (being) translated by asking on the #translations
channel on the Discord server.
Once you're 100% sure that your language isn't already (being) translated (or maybe even when you're not 100% sure, but that might result in your translation being ignored), you can start translating! There are two ways to translate, both assume that you already have an account on Github. What you should choose depends on your skills in IT, because the hard way requires you to do some command-line stuff.
Regardless of your chose, it is appreciated if you tell Olle (omkelderman) in the #translations
channel on the Discord server (mention @OMKelderman) you're working on a translation.
Awesome! Existing translations can sometimes miss certain messages because those messages where added after the translation was finished. If you update an existing one instead of creating a brand new one, both ways should do with a few notes (which probably are kinda obvious):
- In the easy way in step 1 go to the file of the language you're updating and skip step 4 and 9 (also step 8 probably won't apply).
- In the hard way pretty much the same: edit the existing file and skip the part about copying and renaming files.
- Go here: https://github.com/Tillerino/Tillerinobot/edit/master/tillerinobot/src/main/java/tillerino/tillerinobot/lang/Default.java
- Edit everything which is between
"
. In code terms, these arestring
s, aka simple text. You should translate everything in the strings EXCEPT FOR commands such as!help
or/np
. TheoptionalCommentOnLanguage
message is a special one. The bot sends it after you picked this language. Translating the English message makes no sense. Most translations use "YOUROSUNAME helped me learn YOURLANGUAGE" here. - Double-check that you translated everything correctly
- On the top, rename the file from
Default.java
toYOURLANGUAGE.java
, likeItaliano.java
orEspanol.java
. Please note that you should name it without any special characters to garauntee that it will work everywhere (aka: without any accents or whatnot). - On the bottom, type "Translate YOURLANGUAGE.java"
- You don't have to put a description, but if you want to, go ahead!
- Click that big button called "Propose file change". You're almost done!
- Note that on the resulting pull request page Travis CI will complain and spit out errors. Don't worry about it. That is to be expected. The easy way is designed to make it easy for you to translate, not to make a perfect pull request. We'll handle it from here!
- The very last thing to do is to leave a comment on the pull request with the name of your language translated in your language!
Now wait for any comments or feedback. If there are any problems, for example you accidentally forgot to translate something, you'll be told how to fix it. To update your "pending translation" do the following:
- At the top of the page you'll find something that looks like this:
- Note how it ends in your github username and most likely
patch-1
. This is the name of the branch in which your translation lives at the moment. (You can forget this information once you're done with this guide 😄) - Go to
https://github.com/YOUR-GITHUB-USERNAME/Tillerinobot/edit/BRANCH-NAME/tillerinobot/src/main/java/tillerino/tillerinobot/lang/FILENAME.java
. WhereBRANCH-NAME
is the name of the branch we figured out in step 2, so most likelypatch-1
, andFILENAME.java
is whatever you have called the file in step 4 of the previous section. (YOUR-GITHUB-USERNAME
should be obvious 😜) - Make the appropriate changes.
- Make sure the checkbox "commit directly to ..." is checked:
- Click the button "Commit changes".
This should automatically add the new changes to the existing pull request.
You need to install git. On windows, if you have Chocolatey installed, you can do that easily by typing on Powershell/cmd choco install git
. If you're on linux, even better! You just need to type on a new terminal apt-get install git
. If you're on mac, I'm sorry but I have no idea on how to install git. Remember that on every operating system you can download from http://git-scm.com/'s download page, and if you can't manage to get it to work, remember that google is your friend!
Now that you have git installed, fork the repository. On https://github.com/Tillerino/Tillerinobot, there should be a nice link on the top other than the "Watch" and "Star" ones, which says "Fork". Click it, and Github will do some magic and fork that repository for you. Now, on the page you are redirected to, you will see a nice form with a link, like this one:
Click on the button which says "Copy to clipboard" when you hover it. Go to your Terminal/cmd/Powershell/whatever you use. Go to the folder which you wish to clone the repository (on almost everything it is cd /path/to/folder/
) and then type git clone [that link]
. On a Terminal, you should be able to paste stuff by:
- Clicking the right button on your mouse
- Clicking the right button on your mouse and then clicking "Paste"
- Typing shift + insert (if I remember correctly)
Although, you can't paste stuff by doing CTRL+V
.
Once you've done that, wait for git to finish cloning the repo, and then go to the folder where it cloned it. Navigate through tillerinobot/src/main/java/tillerino/tillerinobot/lang/
and then copy and paste Default.java. Rename the file you pasted as YOURLANGUAGE.java
, like Italiano.java
or Espanol.java
. Please note that you should name it without any special characters to garauntee that it will work everywhere (aka: without any accents or whatnot).
Open the renamed file with a text editor. I highly discourage on windows to use Notepad, because it might not show the file correctly (due to differences with newlines across the various operating systems). You can use Notepad++, Sublime Text, vim... every text editor should work. Now, in the text editor, edit everything which is between "
. In code terms, these are string
s, aka simple text. You should translate everything in the strings EXCEPT FOR commands such as !help
or /np
. The optionalCommentOnLanguage
message is a special one. The bot sends it after you picked this language. Translating the English message makes no sense. Most translations use "YOUROSUNAME helped me learn YOURLANGUAGE" here.
Next step is to open the following file: tillerinobot/src/main/java/tillerino/tillerinobot/lang/LanguageIdentifier.java
(remember the note about Notepad on windows? It applies here as well ^^). This file is list of languages that looks like LanguageIdentifier(YOURLANGUAGE.class),
. Add your fresh newly added language to that list (doesn't really matter where). The LanguageIdentifier
is what people will have to type ingame to select the language. Most (if not all) languages use the name of the language translated into that language. YOURLANGUAGE
should be the name of the file you just added if that wasn't already obvious 😉.
Once you're done, go back to cmd/Powershell/whatever and go to the folder where the git repository is. If you haven't already configured git with your email and username, type:
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL ADDRESS"
Obviously, change YOUR NAME and YOUR EMAIL ADDRESS to your name and your email address. You should use the same email address that you used when you signed up on Github. Once you've done this, in that directory type this (change, of course, YOURLANGUAGE
):
git branch patch-1
git checkout patch-1
git add .
git commit -m "Translate YOURLANGUAGE"
git push origin patch-1
this will do all the magic and once you go on your forked repo on github (and change the branch to patch-1 here), you will see the changes. What's next? There should be a few nice buttons. The one that interests us is . Click it, and then on the top you should have something like this (pay attention to the patch-1 branch!). Click the big large button with "Create a pull request", type a title and a description, send the pull request and then you're done! Hoorray!
In case there is an issue with the translation, for example you accidentally forgot to translate something, you'll be told on the resulting pull request page. To update your "pending translation" edit the file (remember the Notepad for windows users thing?) and when you're done with that type the following into your terminal (change, of course, YOURLANGUAGE
):
git add .
git commit -m "Update YOURLANGUAGE"
git push origin patch-1
If you want to support the project, consider becoming a patron:
For more info check out the Donate page!