Skip to content

Instantly share code, notes, and snippets.

@rdwebdesign
Created January 7, 2019 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdwebdesign/9b98569a8ab52ea321688ad8d30fd85c to your computer and use it in GitHub Desktop.
Save rdwebdesign/9b98569a8ab52ea321688ad8d30fd85c to your computer and use it in GitHub Desktop.

Change Sonic Pi language on Raspberry Pi

Start Sonic Pi with a language/translation different from system's language.
Tested only on raspbian.


Overview

Sonic Pi uses the system's language to select the Tutorials translations. There's no preferences, options or congif files to change the translation language.

There are some requests to include translation preferences (issue 1506, issue 611) to change the translation without changing the system's language, but there's no development yet.

So, I decided to use my restricted linux knowledge to change how Sonic Pi sees the system language config.


How to do it?

Actually, it is simpler than I thought. You need to create a new Desktop Shortcut passing some information to make Sonic Pi "thinks" the system is using another language

Steps:

Open a terminal window and create a new file:

sudo nano /usr/share/applications/sonic-pi_EN.desktop

note: alternatively, you can create the shortcut at /home/pi/.local/share/applications/sonic-pi_EN.desktop


Now, you need edit the file. Paste this code inside the file:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=env LANGUAGE=en_US.UTF-8 sonic-pi
Icon=/usr/share/pixmaps/sonic-pi.png
Terminal=false
Name=Sonic Pi EN
Comment=Learn programming and computer science while creating music
Categories=Application;Development;

Type CTRL+X; Confirm (with Y); and ENTER to finish.


You should pay attention to two lines.

The first one changes the name of the shortcut:

Name=Sonic Pi EN

Try to use something different from "Sonic Pi", to avoid confusion with the original one (or simply delete de original).


The second (and most important) line is:

Exec=env LANGUAGE=en_US.UTF-8 sonic-pi

This command uses env to change de environment sending variable(s), and then starts the application. Usualy, env is not required when you are changing environment variable using commands directly on the shell, but it is necessary inside a ".desktop" file.

You can change the language changing the value of LANGUAGE variable.
Examples: en_GB; en_GB.UTF-8; de_DE.UTF-8; it_IT.UTF-8


That's it. Now you can start Sonic Pi in English, keeping your system's config intact.
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=env LANGUAGE=en_US.UTF-8 sonic-pi
Icon=/usr/share/pixmaps/sonic-pi.png
Terminal=false
Name=Sonic Pi EN
Comment=Learn programming and computer science while creating music
Categories=Application;Development;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment