Using Transifex Client on the Raspberry Pi & Android phone

I am using the Transifex Client successfully on the Raspberry Pi and on the Smart Phone, Android 6 (the userland terminal app from F-Droid, without root).

What I did
I used the Raspberry Pi to build the executible tx using docker. Then, I copied it to my phone. The processor architectures are the same. You can use or see the result.

Questions

  • Who else would like to use the Transifex comand line client on Android? Who needs the client tx file?
  • Is it feasible to create a build for these architectures on the main github repository?

Hello @niccokunzmann

My apologies for the delayed response. This looks really interesting!

We have not received any other requests for wanting to use our CLI on an Android phone. However, we are interested enough in what you’ve done to invite you to write a blog post about it. Is this something you’d be willing to do? We would put it on our website… Transifex Blog - Transifex - Localization and Translation Management Tool

In any case, we appreciate knowing this is possible! Thank you for taking the time to let us know about it.

Regards,
Ryan
Transifex Customer Support

Okay, here is the first draft. You can use it and modify it.


Transifex CLI on Android and Raspberry Pi

The transifex-client provides a command-line access to the translations of your Transifex projects. It is also open-source. This is of benefit for the company in ways nobody would be able to predict. This blog post shows an example.

Since January 2022, a the former transifex-client Python library is superceeded by the Transifex-CLI implemented in Go. The Transifex-CLI provides the tx command to update and configure translations of projects such as apps and websites. Since the CLI is open-source, people can tinker with it and adapt it to their use-cases. One of these is to use the CLI on Android.

The Transifex-CLI is provided through a binary file tx. It allows you to to setup the translations for projects on your local file system. These binary files are released by Transifex on GitHub for each new version for Windows, Linux and MacOS. It is possible to build the client yourself so that systems which are not officially supported can also be used. Two of these systems are the famous Raspberry Pi and the Android phone and luckily, they tend to have the same processor: A binary file which runs on the Raspberry Pi 3 with its armv7l architecture also runs on Android phone with the same processor architecture.

Android Setup

This section aims to help you setup the Transifex-CLI on your Android phone.

On an Android Phone there are a series of open-source apps from F-Droid that can be used in conjuction with the Transifex-CLI. The command line interface can be provided by UserLAnd or Termux, if you do not have a Bluetooth Keyboard, also Hacker’s Keyboard is recommended to have access to the arrow keys.

After installing UserLAnd, one can create an Ubuntu environment. Termux runs straight on the Android phone and as such does not need setup.
The following picture shows the Transifex-CLI as it pushes new source files to a project. This is where we want to get to.

After having setup UserLAnd or Termux, you will need to retrieve the binary file. You can compile this yourself, as shown in the section about the Raspberry Pi or download the binary compiled by Nicco Kunzmann from GitHub. These commands should get the binary working on your phone:

  1. Make sure you have the correct processor:
    $ uname -m
    armv7l
    
  2. Download the Transifex-CLI’s tx binary file - you can also point the URL to your Raspberry Pi.
    wget -O tx 'https://github.com/niccokunzmann/transifex-client-armv7l-binary/blob/master/tx?raw=true'
    
  3. Move the tx binary into your $PATH so it is acessible as the tx command.
    mkdir -p ~/.local/bin
    mv tx ~/.local/bin
    chmod +x ~/.local/bin/tx
    echo 'export PATH="$PATH:~/.local/bin"' >> ~/.bashrc
    source ~/.bashrc
    

Now, you are ready to go. You can get help by the client, add resources and pull source files and push translations. The Transifex-CLI source repository shows in detail how to proceed.

On UserLAnd, you can access your SD-card at /host-rootfs/sdcard/. If you like to edit files with other apps, it is recommended that you store your resources there.

If you like to translate files, you might also want to edit them. These open-source apps may help you further:

  • Acode is a code editor which will also show syntax errors for common formats. This is useful when creating new translations as it points out your mistakes editing the files.
  • MGit to interact with Git repositories as they may not yet use the Transifex GitHub integration.
  • OctoDroid to browse GitHub repositories such as the Transifex CLI and report issues.

It is well possible to access the Transifex API on an Android phone using the Transifex-CLI. Access to the SD-card and a variety of open-source apps allow you to create and update resources locally and on Transifex.

Compiling Transifex-CLI on a Raspberry Pi

Compiling the Transifex CLI on a Raspberry Pi is possible with the Docker build it provides. Following this section, you should be left with a working Transifex-CLI on your Raspberry Pi.

The first step is to install Docker. There are various tutorials available online, such as this one on phoenixnap.

After you have installed Docker, you can install git and download the Transifex-CLI.

sudo apt-get install git
git clone --depth=1 https://github.com/transifex/cli.git

Once you have done this, you can build the Transifex CLI according to its documentation:

cd cli
make docker-build

This will generate your tx file. You can store that in your path as mentioned above for the Android phone. With this, you can manage the translations stored in your Transifex project locally on your Raspberry Pi.

Summary

Having created an open-source client for their API, Transifex has allowed hobbyists and enthusiasts to tinker with it and adapt it to their use-cases. As a result, users on Android phones and the Raspberry Pi can synchronize translations. This was not a standard use-case targeted by the management but an open policy with their source code has allowed Transifex niche users to expand the reach of the company.

This is a blog post from the Transifex community by Nicco Kunzmann.

Hi @niccokunzmann

We’ve had the appropriate people review your post, and it looks great! Would you want to provide us with a profile pic we can use for when we add this to our official Blog? You could also send it to us via email (support@transifex.com).

Ryan
Transifex Customer Support

Helo Ryan,

I mailed and image to the support e-mail a while ago. I do not know if it arrived. If not, here is a link to one:

I understood that it should be a picture of my face?

If you decide to publish the blog post, I am happy to have the link posted here, so it fits into the discussion :slight_smile:

Best Regards,
Nicco

Hello Nicco,

I’m happy to let you know that we have published your blog post! Thanks so much for taking the time to do this.

All the best,
Ryan
Transifex Customer Support

Hi @Ryan,

thanks for letting me know!
I think, it is ok like this.
When I read through it, I thought about that:

  • One of the first sentenes reads

    But how about Android or Raspberry Pie?

    The Pi is without e.

  • The links have a number behind them - it is ok but I wonder what it means.

All the best,
Nicco

Hi,

Did the article get fixed maybe, as I don’t see where in the article where it says “pie”?

I also do not see links with numbers behind them, but I might be looking at the wrong thing. So, can you please share an example?

Thanks,
Ryan
Transifex Customer Support

One, the Pie seems to be in the meta data, see screenshot 1.
The links with the numbers appear in screenshot 2, UserLAnd and Termux.
I hope the screenshots are appended.

Hi @niccokunzmann ,

These issues have been fixed now. Thanks for letting us know!

Regards,
Ryan
Transifex Customer Support