One lazy Sunday afternoon, while enjoying my weekly portion of stegt flæsk med persillesovs (the only dish that can truly reboot your soul), I stumbled across a post on Hacker News about a wild GitHub project: https://github.com/bnjbvr/rouille. With a sprinkle of procedural macro magic, someone had made it possible to write Rust (or should I say, Rouille) in French! As a Dane with a soft spot for both programming and linguistic mischief, I was instantly hooked. To my delight, I discovered someone had even started a Danish version. The Little Mermaid herself would have shed a tear.
The Little Mermaid of Programming Languages
So, like any self-respecting Dane with too much time and too much persillesovs, I forked the repo. I dove in, adding more Danish translations for the Rust standard library and added an example that would make even Hans Christian Andersen say, “det var dog pudsigt!”
The best part? Because it’s all done with macros, your Rust linters and checkers still work flawlessly. It’s like putting a viking helmet on the compiler — it looks different, but it still just as strict.
From Macros to Medisterpølse
The transformation began with the basics. match became sammenlign (because what is programming if not a never-ending comparison of things?), loop became løkke (which, let’s be honest, sounds much more hyggelig), and my personal favorite: panic! became lort! (which, if you don’t speak Danish, is exactly what you shout when your code explodes).
Here’s a little taste (served with a side of bacon):
tilsvar x { 42 => { udskrivlinje!("stegt flæsk") } _ => udskrivlinje!("persillesovs")}If that doesn’t make you hungry for both code and traditional Danish cuisine, you might be a robot (in which case, welcome, fellow machine!).
Lost in Translation?
Now, let’s address the elephant in the room (or perhaps, the mermaid on the rock): some of these translation choices are, well, uniquely Danish. You might wonder why we picked them:
OptionbecameMåske(“maybe”—because, let’s face it, Option is just Rust’s way of saying “eh, maybe?”)NonebecameIngenting(literally “nothing”—we Danes don’t beat around the bush)ErrorbecameBommert(a more fun version of an error). And because they both have doubled consotants it is obvious thatErrshould becomeBomm(almost boom).panic!comes in three delightful flavors:lort!– for when everything goes spectacularly wrongmøg!– for the Danglish speakers who want to keep it internationalhovsa!– for when you need to keep things SFW (or your boss is watching)
The Repository
Ready to write your own Rust code with a side of Danish cuisine? Check out the repo at github.com/georglind/rust-dk. Contributions are welcome—just remember, all pull requests must include a recipe for persillesovs or a photo of you posing with “Den Lille Havfrue”.
Because just as stegt flæsk is nothing without persillesovs, every programming language is better with a little local flavour. Why not make it Danish?