Multilanguage with thai

Hi. I have to implement Thai as a language in an existing kirby website which is running in german and english now. Since Thai uses a completely different alphabet, a different font must be used. Has anyone had any experience here? Is there some kind of “best practice”?

Many thanks in advance,

I can’t think of anything, it’s easier for Thai because it reads left to right, so at least you don’t have to mess around with text direction.

If you wanted to only load the Thai font on pages with Thai content, you can do it like this (change the ‘th’ for whatever code you declared for Thai in your config.)

<?php if($page->content('th')->exists()): ?>
<!-- Thai Font -->
<?php else: ?>
<!-- Other Font -->
<?php endif ?>

I am not sure happens with with the Thai language variables in the panel, I would think you would need to load in custom font there to. You can do this with a custom panel stylesheet. However, Kirby is multilingual so I think it will be ok without doing that.

I think you have several options

  • use a font that supports both Thai and the other languages you need


  • in your header, load fonts conditionally as suggested by @jimbobrjames
  • in your stylesheet, use language code of html element to conditionally use one font or the other

In the moment I’m trying this in my header and it works fine for me. Is there anything wrong with that?

<?php if($site->language()->code() == 'th'): ?>
     ... Thai Content
<?php endif ?>


I’m not 100% sure but i think it’s possible to have the site language code as Thai but the content will be in English or whatever you set the default to if Thai content does not exist. Kirby will fall back if its missing. I think its safer to actually check for Thai content.

No, nothing wrong. However, it will fall back to non-Thai content if no Thai content is available.

Will you translate everything? Or will you display non-Thai content if no Thai content is available?

The best strategy will depend on whether or not you will have mixed content, e.g. on a blog list page.

I thinks there will be some english text as well.

@jimbobrjames That makes sense for me. :+1: Thanks

If you have mixed content on one page, though, for that page you would have to load both fonts…

Yep. That’s what I’m doing. :slight_smile: