Hugo: Custom language codes not support in multilingual setup

Created on 6 Jun 2017  路  17Comments  路  Source: gohugoio/hugo

Most helpful comment

@bogem thanks! I'll start as soon as I get some free time!

All 17 comments

@bogem what is the status on this?

@nicksnyder fixed it in https://github.com/nicksnyder/go-i18n/pull/79. We should update this library and integrate this feature in hugo

@bogem I have pulled in the lates go-i18n, could you have a look it at it? We could maybe label it as Hacktoberfest and hope someone will chime in during that month? Then we could just help him/her implementing it? Sounds good?

@bep yes, sounds good. Anyway it's easy to solve. If nobody will fix this issue on Hacktoberfest, I will do it.

Hey @bep, @bogem - I'd like to contribute but I'm not sure where to start and what needs to be done. Could you give me a heads-up?

As far as I understand the problem was loading languages which do not follow the Unicode CLDR standard naming. From the linked issue in go-i18n I understand that this can be fixed by registering the languages with RegisterPluralSpec so that we (hugo) can load whatever languages the user wants to have?


I've not yet worked with i18n in hugo, but I've been using hugo for a year or so and follow the development closely. :)

From the linked issue in go-i18n I understand that this can be fixed by registering the languages with RegisterPluralSpec so that we (hugo) can load whatever languages the user wants to have?

You are totally right. All the logic of loading the i18n is in initFuncs. Start there.
And don't forget to write tests.

@bogem thanks! I'll start as soon as I get some free time!

Good luck馃憤
If you need help, don鈥榯 hesitate to write here.

@bogem I created a Pull Request #3971

I had to update the Update function from TranslationProvider. This package is not tested - where should I add tests now? I tested the modification by creating a demo side and running my modified code against it with a language called "rando".

@kevingimbel You should add tests to i18n_test.go. There are a lot of examples, how you should make tests.

@bogem I have added this to an upcoming "language themed" Hugo release, and it would be great if you could take some lead on getting the PR in question into a mergeable state. Let me know if you need my help.

Sorry, I was on vacation. Now I'm here

I get some related "nil pointer" now when I run this on my site with two (valid) languages. I think this one needs some more testing.

I had to revert this to how it behaved before. The fix for this at least broke existing sites. I got a nil pointer in the Plural func inside of go-i18n. I notice that an empty plural spec is created even for the valid languages (which has a built in plural spec) which I don't think makes sense. It doesn't work, for one.

@bep Do you think we can do anything about it or is it a go-i18n problem?

I really need this in the upcoming release, so I'm going to take a stab on fixing this myself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sigma picture sigma  路  3Comments

vielmetti picture vielmetti  路  3Comments

crash-dive picture crash-dive  路  3Comments

MunifTanjim picture MunifTanjim  路  3Comments

ianbrandt picture ianbrandt  路  3Comments