Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-i18n fails on custom language codes #72

Closed
n10v opened this issue Jun 6, 2017 · 5 comments
Closed

go-i18n fails on custom language codes #72

n10v opened this issue Jun 6, 2017 · 5 comments
Labels
accepting PRs Pull requests from the community that solve this problem would be appreciated. enhancement

Comments

@n10v
Copy link
Contributor

n10v commented Jun 6, 2017

If user wants to have custom language code that aren't in Unicode CLDR (like at.yaml, dk.yaml, ch.yaml, gb.yaml, etc.), bundle.ParseTranslationFileBytes returns no language found in "dk.yaml".
I don't think that users should be limited only with CLDR languages. They can freely use language codes they want and it can be technically implemented.
Discussion: https://discuss.gohugo.io/t/i18n-country-codes-as-part-of-the-url/6881

@bep
Copy link
Contributor

bep commented Jun 6, 2017

I agree. In Hugo we use this language code as part of the URL in a multisite setup, and I have always assumed that I could abuse this feature to make multisite setups of whatever term I want, even non-languages. And even if we do restrict it to languages, I don't see why go-i8n should stop me from creating my own custom language.

@nicksnyder nicksnyder added accepting PRs Pull requests from the community that solve this problem would be appreciated. enhancement labels Jun 6, 2017
@nicksnyder
Copy link
Owner

This sounds reasonable to me and it probably isn't that difficult.

You might only need to export registerPluralSpec. Then during your application's initialization register whatever language ids you want.

@n10v n10v changed the title go-18n fails on custom language codes go-i18n fails on custom language codes Jun 6, 2017
@n10v
Copy link
Contributor Author

n10v commented Jun 6, 2017

You might only need to export registerPluralSpec. Then during your application's initialization register whatever language ids you want.

I have an idea to make it simpler and without exporting something. Hopefully it will work.

@n10v
Copy link
Contributor Author

n10v commented Jun 6, 2017

n10v added a commit to n10v/go-i18n that referenced this issue Jun 6, 2017
n10v added a commit to n10v/go-i18n that referenced this issue Jun 6, 2017
n10v added a commit to n10v/go-i18n that referenced this issue Jun 7, 2017
@nicksnyder
Copy link
Owner

I merged #79 which exports Operands and RegisterPluralSpec. I think this should unblock you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PRs Pull requests from the community that solve this problem would be appreciated. enhancement
Projects
None yet
Development

No branches or pull requests

3 participants