Conflicting xml:lang attribute woes


Singapore photo by Majush
Singapore photo by User:Majush on Wikipedia

This is yet another example of why growing up in multiple countries and cities stuffs you up as an adult. Don't get me wrong, I wouldn't have traded living in different places for anything in the world because it really opened my eyes and allowed me to expand my views of the world outside Australia, but it wasn't all a free lunch. Like having prata and teh tarik at 3am. Where was I going with this?

Today's example is the XML language attribute which the relative XHTML standards demand. I could just define the xml:lang and lang tags in the html element as "en" for English. The problem is English is so generic these days as to be next to useless. I use the original English spelling instead of American spelling for most words given I'm an Aussie, but I also use more than a few Singaporean colloquialisms. Aiyo. For this reason using "en-au" probably wouldn't be completely accurate, but "en-sg" would be even less accurate. "en-gb" would reflect the spelling, but then there's the problem that Google might index my page as one originating from the UK.

Do Austrians who have since moved to Switzerland or Germany have this problem? Or Germans who have since moved to Austria or Switzerland have this problem? Or do Schweizerdeutsch speakers who have since moved to Germany or Austria have this problem?

Perhaps I should just set my language to Klingon and be done with it.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.