Ysgrifennu Côd Yn Gymraeg (Writing Code In Welsh)

Part of traveling the world as an Anglophone involves the uncomfortable realization that everyone else is better at learning your language than people like you are at learning theirs. It’s particularly obvious in the world of programming languages, where English-derived language and syntax rules the roost.

It’s always IF foo THEN bar, and  never SI foo ALORS bar. It is now possible to do something akin to OS foo YNA bar though, because [Richard Hainsworth] has created y Ddraig (the Dragon), a programming language using Welsh language as syntax. (The Welsh double D, “Dd” is pronounced something like an English soft “th” as in “their”)

Under the hood it’s not an entirely new language, instead it’s a Welsh localisation of the Raku language. A localisation file is created, that can as we understand it handle bidirectional transcription between languages. The write-up goes into detail about the process.

There will inevitably be people asking what the point of a programming language for a spoken language with under a million native speakers is, so it’s worth taking a look at that head on. It’s important for Welsh education and the Welsh tech sector because a a geeky kid in a Welsh-medium school Pwllheli deserves to code just as much as an English kid in a school near Oxford, but it goes far beyond Welsh alone. There are many languages and cultures across the world where English is not widely spoken, and every single one of them has those kids like us who pick up a computer and run with it. The more of them that can learn to code, and thrive without having the extra burden of knowing English, the better. Perhaps in a couple of decades we’ll be using code from people who learned this way, without our ever knowing it.

As your scribe, this needs to be added: Mae’n ddrwg gyda fi ffrendiau Cymraeg, mae Cymraeg i yn wael iawn. Dwi’n dôd o’r Rhydychen, ni Pwllheli.


Header image: Jeff Buck, CC BY-SA 2.0.

18 thoughts on “Ysgrifennu Côd Yn Gymraeg (Writing Code In Welsh)

  1. On the one hand I agree that representation is important. On the other, the Welsh programmer can now collaborate with the subset of Welsh speakers who are also programmers, but none of the millions of people who don’t use Welsh. In my opinion it’s doing a disservice to them.

    Of course, programming is not about the language, it’s about thinking. If a person can’t think then they won’t be programming in any language.

    There’s probably only a couple of dozen keywords, and a handful of popular constructs to learn (IF..THEN, WHILE…, FOR…) etc. Writing English keywords, or in some cases just symbols, with native language variable names and comments is far more useful. Now a non-Anglophone can look at source code from anywhere and follow the structure.

    Source: Me. I speak four languages, and program in whatever language is appropriate.

    Actually, having thought about it a little more I can see it might be useful to program in Welsh, to remove the first barrier to learning, but in the long term the student should move on.

    1. On the other, the Welsh programmer can now collaborate with the subset of Welsh speakers who are also programmers, but none of the millions of people who don’t use Welsh. In my opinion it’s doing a disservice to them.

      In the case of Welsh its even more silly than that, as they do all in theory anyway HAVE to learn English anyway, and in many cases sadly are rather more likely to be English language first and at home – if you are in a bilingual school and learning Welsh and English I think that is great. Would be a nice thing if all the UK kids got a taste of at least some of the UK’s languages and dialects and the history that goes with it. But when it comes to programming when you must already know English coding in Welsh is just fun/obtuse for its own sake really.

  2. uncomfortable realization that everyone else is better at learning your language than people like you are at learning theirs.

    Uhm, no. Its just that they have an incentive to start learning your language at an early age and continue to do so across they’re lives while you’re learning theirs in a short period and mostly for vanity.

  3. I remember a book describing a student who created a program for translating BASIC programs written using multiple languages, including Tagalog. Unfortunately I don’t remember the book nor can I find info about it online.

  4. Since it uses a localization file, any programmer can load the preferred localization faile in his IDE, and the source code will appear in the choosen language. Only the comments may be left untranslated.

  5. Being able to code in any programming language with the syntax in your human language is nice in theory, but in practice, it won’t work.

    Why not? Libraries, or rather the decades of existing libraries we have and use every day. Making localizations of these many libraries is just not realistic, at least not for languages that have been in use a long time and have a rich base of existing “English” libraries.

    Much more practical would be an editor that had “hover-help” “suggested translations” from English to the programmer’s native language so he could have a clue of what words like “IF” and “THEN” mean, without actually changing the code from it’s “English” version.

  6. “Mae’n ddrwg gyda fi ffrendiau Cymraeg, mae Cymraeg i yn wael iawn. Dwi’n dôd o’r Rhydychen, ni Pwllheli.” …. dont worry, most people in Pwllheli dont speak ‘proper’ Welsh anyway – they have their own dialect.

  7. “It’s always IF foo THEN bar, and never SI foo ALORS bar.” That’s not strictly true. A nice way of saying completely untrue. And this is different, but you can say “OTHERWISE” instead of “ELSE” in COBOL, at least you used to could.

    1. I see the welsh language department at Aberysthwyth uni have manufactured a translation for the English word “code” . C^od is hardly very imaginative though, no ll’s in sight.

      1. To be fair every word thats come into being since about the mid 20th century has required a small committee of grey beards to take the English word and Welsh it up a bit, some with more imagination than others. Ambliwans being one of my favorites.

        Then again it’s not just Welsh that does this, there are far more incongruent words that have snuck into other langauges because what they are describing simply didn’t exist 100 years ago and there isn’t really a translation to fall back on.

    2. In Perl you can say
      bar if foo;
      and you can also say
      if (foo) then { bar; } else { frobozz; }

      You can also use “unless” which is like “if not” in either of those contexts. Perl was created by a linguist who wanted the language to be expressive with different ways of being able to code the same logic. IMO that’s the opposite of what a computer language should be.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.