How to contribute by translating Cinnamon Spices into your own language

coitus
  1 year ago
  0

Hi, this tutorial will show you how to contribute to spices by translating them. Themes don't need translations, so this only applies to applets, desklets and extensions.

      1. Create an account on Github.
      2. Fork the cinnamon-spices-applets, cinnamon-spices-desklets or cinnamon-spices-extensions repository (depending on whether you want to translate an applet, a desklet or an extension).
        Forking screenshot
      3. In your fork, create a branch (named like SPICE_NAME-YOUR_LANGUAGE_CODE) from the master one. For example, in this screenshot, there is a branch for the French translation of the SpicesUpdate applet.
        Screenshot creating branch
      4. On your computer, install git and Poedit (see links for instructions; I don't recommend using the software manager because the packages there are often outdated).
      5. Clone your branch on your computer. Type into the terminal (replace capitalized words accordingly):

        $ git clone -b SPICE_NAME-YOUR_LANGUAGE_CODE --single-branch https://github.com/YOUR_GITHUB_ACCOUNT/cinnamon-spices-XXX.git
      6. A new directory should be created. Navigate into it, then to the SPICE_NAME/files/SPICE_NAME/po directory. Now we need to create a YOUR_LANGUAGE_CODE.po file, or work on it if it already exists. If you don't see your language code, right-click the SPICE_NAME.pot file, and then open with Poedit. Click on Create New Translation at the bottom. Select the language you want to translate into, then get to work.

        If YOUR_LANGUAGE_CODE.po is already in the po/ directory, you can open the file and work on it. You can save with Ctrl+S. A few other useful shortcuts:

        • Ctrl+Enter saves the current translation and moves to the next.
        • Ctrl+B copies the English version
        • Ctrl+Number copies one of the suggestions on the right
        • Ctrl+Up/Down navigates to the next/previous phrase
      7. You can see your progress at the bottom left as a percentage. You don't have to translate all of it, you can stop whenever you feel like it, then save it.
      8. You obtain a YOUR_LANGUAGE_CODE.po file. Add and commit this file to the git repository using the following commands, from the terminal (replace capitalized words accordingly; you have to do this even if the file already existed before you edited it):

        $ git add SPICE_NAME/files/SPICE_NAME/po/YOUR_LANGUAGE_CODE.po
        $ git commit -m "[SPICE_NAME] Added YOUR_LANGUAGE_CODE.po"
      9. Push it to GitHub:

        $ git push origin
      10. Then go back to GitHub and make a pull request.

      11. It might take a while for it to be accepted. You don't need to do anything else.

Questions:

Q: What if I want to translate more applets? Do I have to make a new fork and clone every time?

A:

Nope! You can actually sync from the upstream repository (linuxmint/cinnamon-spices-applets, linuxmint/cinnamon-spices-desklets or linuxmint/cinnamon-spices-extensions). First, navigate to the folder where you first copied your repository. Then, add the upstream (full tutorial here):

$ git remote add upstream https://github.com/linuxmint/cinnamon-spices-XXX.git

Now, every time you want to work on a new translation, you can fetch the latest commits from the upstream branch (full tutorial here):

$ git fetch upstream
$ git checkout master
$ git merge upstream/master
$ git push origin master

Then create a new branch:

$ git checkout -b SPICE_NAME-YOUR_LANGUAGE_CODE

Do your work (steps 6, 7, 8). Then push it to GitHub:

$ git push --set-upstream origin SPICE_NAME-YOUR_LANGUAGE_CODE

And now you can make another pull request from GitHub.

Q: Are there guidelines/best practices for translation?

A: Depends on the language. You can go to the Linux Mint translation section on Launchpad (link here - this is for OS-specific programs, not spices). Look for your language (you might have to click "view all languages" on the bottom right). Then click on a program from the list (from the column under "Template Name"). There should be a notice at the top saying "Before translating, be sure to go through Linux Mint instructions (and X guidelines).". If the second part is missing, then there are no guidelines.

Q: I can't see the sidebar in Poedit!

A: Try switching to a bright theme in Themes > Controls.

Tutorial based on the one written by claudiux for Spices Update.