Current lang is empty

I’ve added Kazakh language in system.yaml kk (it doesn’t existing in Grav) and now my html lang is empty:

<html lang="{{ grav.language.getActive ?: theme_config.default_lang }}">

What’s wrong?

<html lang="">

hmm, looks like that should be fine, so have you set up

languages:
  translations: true

as described in Single language different than English?

Just a guess, but getActive probably needs translations enabled.

I just checked a site I have, where the single language is en-NZ and I don’t have translations enabled. The template has:

<html lang="{{ grav.language.getLanguage ?: theme_config.default_lang }}">

instead of getActive. I think I remember changing that after it didn’t work (like yours). I suspect getLanguage will work anyway if there is only one supported language. Try that if you don’t need translations.

1 Like

Translations are enabled, but “include default language” is disabled, because i won’t use language code, if i have just one language on the site.

That worked, thanks. But this won’t work if we have more than 1 language, right?

Haha, I’m the wrong guy to ask as I pretty much work only in the English language world. My custom en-NZ is about all I’ve done with languages.

Experiment with different combinations or wait for another answer from someone here
who has multi-language experience.