All posts by Nina Szymor

Pulling Raspberry Pi translation data from GitHub

Post Syndicated from Nina Szymor original https://www.raspberrypi.org/blog/pulling-translation-data-from-github/

What happens when you give two linguists jobs at Raspberry Pi? They start thinking they can do digital making, even though they have zero coding skills! Because if you don’t feel inspired to step out of your comfort zone here — surrounded by all the creativity, making, and technology — then there is no hope you’ll be motivated to do it anywhere else.

two smiling women standing in front of a colourful wall

Maja and Nina, our translation team, and coding beginners

Maja and I support the community of Raspberry Pi translation volunteers, and we wanted to build something to celebrate them and the amazing work they do! Our educational content is already available in 26 languages, with more than 400 translations on our projects website. But our volunteer community is always translating more content, and so off we went, on an ambitious (by our standards!) mission to create a Raspberry Pi–powered translation notification system. This is a Raspberry Pi that pulls GitHub data to display a message on a Sense HAT and play a tune whenever we add fresh translated content to the Raspberry Pi projects website!

Breaking it down

There were three parts to the project: two of them were pretty easy (displaying a message on a Sense HAT and playing a tune), and one more challenging (pulling information about new translated content added to our repositories on GitHub). We worked on each part separately and then put all of the code together.

Two computers and two pastries

Mandatory for coding: baked goods and tea

Displaying a message on Sense HAT and playing a sound

We used the Raspberry Pi projects Getting started with the Sense HAT and GPIO music box to help us with this part of our build.

At first we wanted the Sense HAT to display fireworks, but we soon realised how bad we both are at designing animations, so we moved on to displaying a less creative but still satisfying smiley face, followed by a message saying “Hooray! Another translation!” and another smiley face. LED screen displaying the message 'Another translation!'

We used the sense_hat and time modules, and wrote a function that can be easily used in the main body of the program. You can look at the comments in the code above to see what each line does:

Python code snippet for displaying a message on a Sense HAT

So we could add the fun tune, we learned how to use the Pygame library to play sounds. Using Pygame it’s really simple to create a function that plays a sound: once you have the .wav file in your chosen location, you simply import and initialise the pygame module, create a Sound object, and provide it with the path to your .wav file. You can then play your sound:

Python code snippet for playing a sound

We’ve programmed our translation notification system to play the meow sound three times, using the sleep function to create a one-second break between each sound. Because why would you want one meow if you can have three?

Pulling repository information from GitHub

This was the more challenging part for Maja and me, so we asked for help from experienced programmers, including our colleague Ben Nuttall. We explained what we wanted to do: pull information from our GitHub repositories where all the projects available on the Raspberry Pi projects website are kept, and every time a new language directory is found, to execute the sparkles and meow functions to let us and EVERYONE in the office know that we have new translations! Ben did a bit of research and quickly found the PyGithub library, which enables you to manage your GitHub resources using Python scripts.

Python code snippet for pulling data from GitHub

Check out the comments to see what the code does

The script runs in an infinite loop, checking all repositories in the ‘raspberrypilearning’ organisation for new translations (directories with names in form of xx-XX, eg. fr-CA) every 60 minutes. Any new translation is then printed and preserved in memory. We had some initial issues with the usage of the PyGithub library: calling .get_commits() on an empty repository throws an exception, but the library doesn’t provide any functions to check whether a repo is empty or not. Fortunately, wrapping this logic in a try...except statement solved the problem.

And there we have it: success!

Demo of our Translation Notification System build

Subscribe to our YouTube channel: http://rpf.io/ytsub Help us reach a wider audience by translating our video content: http://rpf.io/yttranslate Buy a Raspberry Pi from one of our Approved Resellers: http://rpf.io/ytproducts Find out more about the #RaspberryPi Foundation: Raspberry Pi http://rpf.io/ytrpi Code Club UK http://rpf.io/ytccuk Code Club International http://rpf.io/ytcci CoderDojo http://rpf.io/ytcd Check out our free online training courses: http://rpf.io/ytfl Find your local Raspberry Jam event: http://rpf.io/ytjam Work through our free online projects: http://rpf.io/ytprojects Do you have a question about your Raspberry Pi?

Our ideas for further development

We’re pretty proud that the whole Raspberry Pi office now hears a meowing cat whenever new translated content is added to our projects website, but we’ve got plans for further development of our translation notification system. Our existing translated educational resources have already been viewed by over 1 million users around the world, and we want anyone interested in the translations our volunteers make possible to be able to track new translated projects as the go live!

One way to do that is to modify the code to tweet or send an email with the name of the newly added translation together with a link to the project and information on the language in which it was added. Alternatively, we could adapt the system to only execute the sparkles and meow functions when a translation in a particular language is added. Then our more than 1000 volunteers, or any learner using our translations, could set up their own Raspberry Pi and Sense HAT to receive notifications of content in the language that interests them, rather than in all languages.

We need your help

Both ideas pose a pretty big challenge for the inexperienced new coders of the Raspberry Pi translation team, so we’d really appreciate any tips you have for helping us get started or for improving our existing system! Please share your thoughts in the comments below.

The post Pulling Raspberry Pi translation data from GitHub appeared first on Raspberry Pi.

Celebrating our translators!

Post Syndicated from Nina Szymor original https://www.raspberrypi.org/blog/celebrating-our-translators/

As the world gets ready to celebrate International Translation Day on 30 September, we want to say thank you to our amazing community of volunteer translators. This talented bunch work very hard so that people around the world can learn digital making and computing in their native languages.

Can you help us translate our content?

If you speak an additional language to English, volunteering as a translator is an easy way to make a big difference.

Our translators

The #RPiTranslate community is growing every day, and at the moment we have around 370 volunteers. They are translating our learning projects into 50 languages – everything from Afrikaans, to Tamil, to Scots Gaelic! Projects in 26 of those languages are already available on the Raspberry Pi learning projects website, and we continually add more.

Our translators are all volunteers, and they come from various walks of life. They are students and professionals, translators and coders, young and retired, already passionate about our mission or completely new to it.

Abdulaziz is a language coordinator for the Arabic language team. He is finishing his doctoral research at the University of Toledo in the US, and will soon start working as an assistant professor in the Department of Curriculum and Instruction at King Saud University in Saudi Arabia. He translates for us because he believes our educational resources are great and he’d love to see them used by Arabic speakers of all ages.

Wojtek volunteers at a Code Club in Poland, and helps us translate our projects into Polish because he thinks translations are crucial for learning. When children can access lessons in their native language, they truly understand programming concepts, and that empowers them to experiment and create more.

getting started with raspberry pi

Cor is the main force behind all of our Dutch projects. He is a retired simulator designer and developer for the Royal Netherlands Air Force, and volunteers at a hackerspace in the Netherlands. While teaching young people coding and robotics, he realised how difficult it is for them to learn all of this in English. He decided to translate for us to change that.

Silvia started volunteering for us when she was studying for a degree in translation. She joined us to gain some real-life experience in translation and localisation, but quickly found herself immersed in our amazing community and became passionate about Raspberry Pi’s mission. She is still supporting us now, even though she has finished her degree and is working full-time.

Sanneke is a digital literacy consultant and librarian at Bibliotheek Kennemerwaard in the Netherlands. She runs five Dojos in the area where her library is based. Sanneke translates because it helps children who want to learn to code. English is taught from quite an early age at primary schools in the Netherlands, but having learning resources in Dutch is particularly helpful for young children.

All of these volunteers bring with them a unique set of skills and experiences. They make the #RPiTranslate community an amazing, diverse, successful team.

Raspberry Pi translators: we salute every single one of you. We couldn’t do what we do without you!

A GIF showing lots of Raspberry Pi colleagues smiling, saluting and clapping enthusiastically

Join us

Anyone can join this amazing group of people in their translation efforts. It’s really easy to get involved: you don’t need any experience of translation or coding, and you can choose how much time you want to commit.

Visit our translation page to find out more, or join one of our live Q&A sessions this week to ask our translation manager and language coordinators anything you’d like:

  • Wednesday 26 September at 18:00 BST – join here
  • Friday 28 September at 13:00 BST – join here

Happy translation week!

Special thanks to the Atlassian Foundation and MIT Solve for their continued support in developing our translation community.

The post Celebrating our translators! appeared first on Raspberry Pi.