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

Better example for v2 #101

Closed
winchell opened this issue May 3, 2018 · 4 comments
Closed

Better example for v2 #101

winchell opened this issue May 3, 2018 · 4 comments
Labels
add docs This should be documented better.
Milestone

Comments

@winchell
Copy link

winchell commented May 3, 2018

Could you make a more thorough example for V2?

I'm not sure why NewBundle accepts language.English when later Accept-Language is used as an input. What is a bundle, for that matter?

RegisterUnmarshalFunc is set to toml. Where is there any TOML used?

@nicksnyder
Copy link
Owner

I do think there are improvements I can and should make to the doc in the README. I think a few of your questions are answered by the package documentation. Did you read that?

I'm not sure why NewBundle accepts language.English

https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#NewBundle

It is the default language for your application.

later Accept-Language is used as an input.

https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#NewLocalizer

What is a bundle, for that matter?

https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#Bundle

Where is there any TOML used?

screen shot 2018-05-02 at 8 57 57 pm

@winchell
Copy link
Author

winchell commented May 3, 2018

Thanks!

So, v2/example/main.go does

localizer.MustLocalize(&i18n.LocalizeConfig{
			DefaultMessage: &i18n.Message{
				ID:          "UnreadEmails",
				Description: "The number of unread emails a person has",
				One:         "I have {{.PluralCount}} unread email.",
				Other:       "I have {{.PluralCount}} unread emails.",
			}...

The TOML files -- in the example -- aren't using a .toml file. Right? I could just be missing something.

PS the links in the README are pointing to the V1 examples.

@nicksnyder
Copy link
Owner

the links in the README are pointing to the V1 examples.

Thanks for reporting! Fixed in 481274b.

The TOML files -- in the example -- aren't using a .toml file. Right?

You are right. I meant to add an example TOML file for another language but forgot. I will update that example.

@nicksnyder nicksnyder added the add docs This should be documented better. label May 23, 2018
@nicksnyder
Copy link
Owner

Going to close this. Let me know if you have any other suggestions for doc improvements.

@nicksnyder nicksnyder added this to the v2 milestone May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add docs This should be documented better.
Projects
None yet
Development

No branches or pull requests

2 participants