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.

30 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.

      1. Fascist nutjobs currently in charge of the UK, everybody will be fluent in newspeak soon.

        Posted from England!

        Find me MFers!
        Charge me with wrong think.
        I dare you.

        Festering bizzie (un+s! (acceptable in England).

        Put Scotland yard on the case!
        Spare no expense!
        This kind of unhindered free expression cannot be allowed to stand in England (or ArtsandCrafts a day.)

        If you hit the ‘Report comment’ link, you are just like Hi+ler.

        Also: Canadian C/C++
        #define eh ;

  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.

    1. And there is only one obvious choice to learn, and you can use it everywhere you go. As an Englishman, I’m not less capable of learning languages than anybody else, but I can’t possibly learn the language of every single country/region I may pass through.

      I did go to Hungary a few years after it ceased to be communist, and at the time everybody’s second language was Russian with very little English spoken (this has now changed) which was exactly the same thing – it was the obvious choice.

  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.

    1. Back in the late 80s / early 90s, there was a Welsh translation of LOGO for the BBC Micro, which was my first experience of programming.

      In fact, back in the Beeb and Acorn days, loads of educational software was available in Welsh. The education / technical deparments of councils worked with the publishers, and the Welsh-language market was a big enough fraction of the (bespoke) UK market for the publishers to bother doing so.

      Come the late 90s, when schools had switched over to PCs, we were now a tiny fraction of the worldwide English-speaking market, and the Welsh-language software dried up. I used LOGO for Windows during high school, and was annoyed at having to relearn the English keywords to get anything done.

  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.

    1. I am not wishing to intrude into an argument between North and South Welsh dialects. I learned mine with Say Something in Welsh, and I picked their South course. I am a very bad Welsh speaker, but my halting attempts seem to be tolerated.

  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.

        1. There can be nice, native translations too:

          A memory stick / USB drive / flash drive is a “cof bach” (little memory).

          A mobile phone / cell phone is a “ffôn lon” (road phone) or ffôn boced (pocket phone) to many, even though the official term “ffôn symudol” is a literal translation of mobile phone.

          “Teledu” (television) is based on “tele” and “lledu”, the latter of which means spreading or broadcasting. I’m not too concerned whether “tele” was picked up frm the English, given that they got it from Greek in the first place.

          Plus, the grey beards don’t have an official role in Welsh like they do in the Académie Française. What you will find is that various public bodies, authors and broadcasters (or even presenters live on air) will find they need to come up with a term to describe someting, and the most popular one tends to stick. The BBC invented/standardised many rugby terms when they started broadcasting commentary of rugby matches, for example.

    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.

      1. In perl, you can say “use Lingua::Romana::Perligata;” and after that write EVERYTHING in latin. This is not just a word-by-word translation, but also changes the grammar of Perl to latin. The only interpunctation is the full stop “.”, no “$@%#!”. Even regular expressions and embedded documentation (POD) are changed to latin.

        https://metacpan.org/pod/Lingua::Romana::Perligata

  8. I know a couple of Welsh folks that can barely write out a -sentence- in their native dialect, much less programming code! They have told me that to them, it’s almost more like cryptography. And they were born and raised in Wales. Beautiful countryside, though.

  9. fwiw, for some years now, C accepts extended characters in identifiers, even in the preprocessor. Pretty sure most compilers have accepted UTF-8 in this role for ages. So you are still stuck with #include #define #if etc but for the regular (after pre-processor) language keywords, there’s nothing stopping you from making a .h file that provides “#define [utf8magicsymbol] if” to get keywords in whatever language you want. I think. I don’t actually use UTF-8 so i can’t prove it’s true :)

Leave a Reply to Greg ACancel 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.