Monolingual site getting "no translation bundle" warnings

Hi - I have a monolingual site using Hugo v.20, but I’m getting warnings like:

 WARN 2017/04/24 09:07:46 No translation bundle found for default language "en" 
 WARN 2017/04/24 09:07:46 Translation func for language en not found, use default.    
 WARN 2017/04/24 09:07:46 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.

… when running hugo server.

I have had languageCode = "en-us" in my config.toml to refer to it in templates, and added defaultContentLanguage = "en" to see what would happen, but, I’d like to get rid of errors and warnings in the log.

I see that if I do have a multilingual site, I can add an i18n folder and language blocks to the config.toml. Do I need to add these for a single language to get rid of the warnings?

Any advice appreciated.

1 Like

We may do something about those warnings (which is kind of INFO in this context), but:

A config.toml configures 1 or more sites. So a multilingual configuration have more than 1, but there are not much more special about it. So a 1 site configuration will also get a language setup (i.e. i18n bundles); it may not be as relevant in this case, but you may thank us in the future when you add that second language …

What I suspect you need to get rid if these warning is to just dump an empty file in:

/i18n/en.toml

1 Like

Thanks @bep. I added the empty /i18n/en.toml and restarted hugo server. Now I get only one warning:

 WARN 2017/04/24 16:33:56 No translation bundle found for default language "en"

I’ll go ahead and add the config when I can, to get used to it because I need to convert a site to use this method once I understand a bit more.

Appreciate the help.

That is a little bit weird, maybe you can test by putting one dummy translation string in that file:

[wordCount]
other = "{{ .WordCount }} words"
1 Like

@bep, yep, that did it. No more warning after adding that.

1 Like

I get the same warnings when building my monolingual sites (and in the log outputs). Can I configure something to tell Hugo I’m having a single-language website? (I looked at the configuration variables page but couldn’t find any).

Is there another approach to removing those warnings than adding redundant files to my project?

My reasoning for wanting to remove those warning is to keep Hugo running as efficient as possible. If I add additional files to the project just to suppress those warnings, Hugo might still execute all the multi-language features I don’t need.

(My Hugo performance is not bad, but just wanting to have a ‘clean house’ if that makes sense.)

+1

I am making my first steps with hugo, created a site from scratch and started with a freshly created template. With the first output I received

No translation bundle found for default language "en"

Obviously I shouldn’t have changed my language in the config.toml of the site. But what if I want to…?
I changed it back to en-en but still i get the error message.

A solution would be appreciated!

The solution is still what bep mentioned above, adding a string to /i18n/en.toml.

@RickCogley how you add the empty /i18n/en.toml ??

Just do what is mentioned above: Monolingual site getting "no translation bundle" warnings