DEV Community

Cover image for Multi-lingual Chicken and Egg
Ayelet Dahan
Ayelet Dahan

Posted on

Multi-lingual Chicken and Egg

A colleague uploaded this image to the company Slack

Chicken and Egg Sorted

The claim was "Finally, it's sorted".

Being bi-lingual, I wanted to challenge that, as in my language, the word for egg appears lexicographically before chicken. Funnily enough, even the phrase itself exists, but the phrase reverses the order of the words - while in English the phrase is "What comes first, the chicken or the egg", in my language, the nouns are reversed.

What do you do when two parties disagree? Look at everyone else!
I found this website which translated the words for me into all the languages it had available (101).
I chose to include also a translation for "Hen", as "Chicken" is the meat you eat, while "Hen" is the animal which lays eggs. It will translate into a different word in many languages.

This site is also great because it lets you export the translations as a JSON or a CSV file! 😍

There isn't anything too exiting about the implementation. I grouped the words by languages and then for each tuple I sorted the items and counted "which came first".

This was the bottom line:
Egg is the winner

It is a little tight between the chicken and the egg, with the egg having one more win, but if you account for the egg vs. hen, the egg wins big time!

The world has said it's piece. The egg came first. 🥚

You can find the source code here. You are welcome to code review it and improve it.

Discussion (0)