How former British politician Ed Balls can help you translate your frontend application
Posted on Oct 10 2021
On April 28 2011, former British Shadow Chancellor of the Exchequer Ed Balls tweeted this:
Ed Balls
— Ed Balls (@edballs) April 28, 2011
Chancellor of the Exchequer is pretty much the second most important position in British government after the Prime Minister… Luckily at the time he was only the opposition 🤦♂️
It was a wonderful day of humour for most Brits to have an innocent giggle at our political leaders before getting back to making tea and grumbling about the weather (or whatever it is we are stereotypically known for). I was nearing the end of University at the time and working hard on things with the Web Audio API (cutting edge stuff!). Little did I know that this tweet would resurface in my life a few years later when I joined a SaaS start-up - GoSquared.
Within the first few weeks of being onboarded to the various frontend and backend systems, one of the co-founders showed me some “Easter eggs” that were built in to the frontend. Some of these were purely comical (typing barrelroll anywhere would spin the window by 360 degrees) whereas others had a very practical application. In particular…
Ed Balls Mode
Ed Balls mode does one simple thing. It adds a custom translation language which copies all known keys from an existing language and sets the values to - you guessed it - Ed Balls. The effect looks something like this:
Ed Balls @GoSquared pic.twitter.com/hV7iLDHcd6
— Simon Tabor (@simon_tabor) April 28, 2015
My co-worker at the time (not Ed Balls) showing the power of Ed Balls
The outcome is simple but visually stark. All text that is correctly configured for translation will be replaced with Ed Balls.
… but why?
Other than this being a fun thing to do with your translation code, it is an incredibly practical way of visualising which of your text is correctly translated and which values were perhaps missed. As developers (in particular those from English speaking nations…) we are often start projects without thinking about or having the time to implement multiple languages. Even when we do, it is not uncommon to lazily hardcode text thinking “I’ll register the correct translation code later”. This trick helps to visually point out these missed text entries and hopefully putting a smile on your face in the process!
… but why are you mentioning this 10 years later?
The last months I have been working on a small, soon to be released mobile app and as I live in Germany I am keen to release it with at least support for English and German. As with most side projects, I of course didn’t bother to template out my i18n code at first and when I finally got around to that task I remembered the old Ed Balls mode and decided to give it a go. It has already helped me catch multiple strings that I missed whilst refactoring the codebase and indeed put a smile on my face.
You can find a gist snippet with all the important bits of how I got it working below:
I hope Ed Balls can help you with your internationalisation efforts too!
Disclaimer: I have no political affinity for Ed Balls and no opinion on him or politics in general. This is a fun post about internationalisation and comedy of errors ☺️
Ed Balls - Ed Balls