Translating Cinnamon desktop spices with help from machines

August 6, 2022

Linux Mint relies on its users to translate it. There are guides that teach you how the translation workflow, both for Mint itself, and for its optional Spices.
Unfortunately, as the translation tables show as of July 2022, Spices are mostly untranslated. This is probably because translating by hand can be time-consuming and tedious. So machine pre-translation can be a welcome aid in accelerating this. This tutorial will teach you how to use it. Remember that you still need to be fluent in the language you’re translating, because you must still manually check all translations. Still, this turns a ~1-week job into a ~2-hour job.

Steps:
1) Preparation: Follow the spices translation guide, up until the part where you create a new branch. The branch should be called something that clearly describes what you’re doing. I named mine lots-of-ro-translations because I was just adding a lot (all) of the Romanian translations. I advise you to use VS Code since I wrote this tutorial with it in mind.

2) Create .po files: Go to the root of the repository, in the Terminal. Run the following command (make sure to replace your_language_code with your own language’s code):

find . -name ".pot" -exec sh -c 'pot_file="{}"; base=$(basename "$pot_file" .pot); lang="your_language_code"; po_file="$lang.po"; if [ ! -e "${pot_file%/}/$po_file" ]; then msginit --no-translator -i "$pot_file" -o "${pot_file%/*}/$po_file" -l "$lang"; fi' \;

This will create a .po file in the same directory as each .pot file. Some .po files might already exist, so we skip them. After you’ve created all of the new .po files, you can commit them. The VS Code diff view is useful here. Use a message like “Create all .po files for [your language]”. It’s good to keep separate steps in your work in separate commits.

4) Installing required software: Install PHP 8.1 (instructions for Mint 20) and potrans. Potrans will do most of the magic for you. Make sure you install composer the way potrans advises you. Install also the PHP curl extension, as potrans advises. If you’ve used the PPA for installing PHP, install php-curl from the same PPA. Use apt show php-curl to make sure it’s the same one.

5) Get API key: Create a DeepL API account, use the free trial. Make sure it’s an API account because they also have a premium option for their website. Get the API key, for the next step.

6) Create and run the script: In the potrans directory, create a new bash script, with the following contents:

for file in /home/yourusername/spices/cinnamon-spices-desklets/*/files/*/po/yourlanguagecode.po; 
do 
bin/potrans deepl  "$file" "$(dirname "${file}")"  --to=yourlanguagecode --apikey=yourapikey;
done

Make sure that you replace desklets with the directory you’re working on, as well as replacing your username, your language code, and your API key.

Run this bash script in the terminal. Sit back and watch the progress bars. You can also look at the usage tab of your DeepL account to check if you’re getting anywhere near the usage limit (you probably aren’t). Check the diff in VS Code and commit the changed .po files, with a message like “Run the translation script”.

7) Check and fix translations by hand: This part took the longest, in my experience (about 2h, also depends on how much is already translated). I advise you to use VS Code and just filter the files for your language. With the project open, search all files (Ctrl+Shift+F) for a string you can only find in your language’s files. For example, searching for the string “Language: ro” will only show the ro.po files. I couldn’t find another better way to filter the files. Go through each result. Look through the entire file for each. Fix any errors in the machine translation. For example, make sure the level of formality is consistent, and make sure the vocabulary used is consistent (for example, either always translate the word “desktop” or never do it). You can be smart about it by using global search and replace (Ctrl+Shift+H) to fix all instances of a mistake in all files at once. Once you’ve checked all the files, commit your changes.

8) Make the PR: You can now make the Pull Request, as instructed in the original tutorial. Then wait for it to get accepted & merged.

That’s it! Good job, you’ve made a big contribution to the Linux Mint project.

How to make the Cinnamon DE look like Windows XP

September 23, 2020
Note: This tutorial is an evolving work and might change at any time.
A reference image showing what this tutorial aims to emulate.

Love it or hate it, Windows XP, nicknamed the Fisher-Price OS, has been a big part of many people’s lives. Enjoying a market share of 86.80% at its peak, it was a great influence on subsequent operating systems and desktop environments.

This tutorial will teach you how to create the closest possible imitation of the Windows XP desktop environment in Cinnamon. It was written with Cinnamon version 4.6.7 in mind and is mostly based on themes developed by the b00merang project (check them out!).

Downloads

Window Borders, Controls & Desktop

Start by downloading the Windows XP theme from project b00merang: link here. Copy the Windows XP Luna folder into ~/.themes. You can also copy the other folders as well if you want some of the other default Windows XP themes. You can see what each one looks like on the theme’s GitHub page.

Icons

Then download the Windows XP icon set: link here. Copy the Windows-XP-3.1 folder into ~/.icons.

Start Menu

The closest thing to the Windows XP Start Menu is CinnVIIStarkMenu. You can get it by going to Applets > Download > Search for its name. Also, download this JSON file containing the settings it needs. On line 167, replace username with your own username.

Fonts

Install ttf-mscorefonts and Tahoma by following this guide.

“Bliss” wallpaper

I’ll leave downloading that as an exercise to you.

Setting things up

Go to the Themes menu (or type cinnamon-settings themes into a terminal) and select the Windows XP themes for Window borders, Icons, Controls & Desktop.

Make sure you only have one panel, on the bottom of the screen. Set its height to 30px. We will now refer to it as the taskbar.

Right-click on the taskbar > Applets > Manage, then look for CinnVIIStarkMenu and add it to the taskbar. Move it to the leftmost edge of the taskbar (you need to be in “Panel edit mode” which you can enable from the right-click menu of the taskbar). If you had another menu before, remove it. Right-click on this new menu, then Configure > Click the 3 lines on the top right > Import from a file > Find the JSON file winxp_settings_for_menu.json.

At this point, we could also add the Quick-Launch menu using the Panel Launchers applet, but it the b00merang themes do not cover it properly yet.

Windows XP had no window shadows. So, to disable them, you need to specify the value of MUFFIN_NO_SHADOWS in your ~/.bashrc file. This command will do that:

echo export MUFFIN_NO_SHADOWS=1 >> ~/.bashrc

Then open a terminal, and type source ~/.bashrc to o load the new environment variables into the current shell session. You should then restart Cinnamon, by pressing Alt+F2, then typing r and then Enter. If you still have window shadows, this change should take effect the next time you reboot. To get the shadows back, you need to open ~/.bashrc again and remove the line, then type export MUFFIN_NO_SHADOWS=0 into the terminal, then restart again.

Also check out K.Mandla’s blog post about imitating the look of Windows XP Classic in IceWM.

For reference, this website contains many screenshots of Windows XP.

Reviving my blog

September 23, 2020

I got my first computer when I was around 12 years old – in 2008. Once we got an internet connection one year later, I proceeded to dive head first into the web, exploring every little corner I could find.

This is why I made a WordPress blog. I also made a blogger account and a reddit account, which I’ve since deleted.

I recently realized that I would actually want to have a blog where I can write down my thoughts, ideas, and maybe teach a bit. This is why I dusted off the old Yahoo! address and logged into WordPress again. I’m going to keep the old theme, as I really like it, and the first post.

Hello world!

March 13, 2009

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!