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

V2 #92

Merged
merged 41 commits into from
Apr 15, 2018
Merged

V2 #92

merged 41 commits into from
Apr 15, 2018

Conversation

nicksnyder
Copy link
Owner

@nicksnyder nicksnyder commented Apr 5, 2018

API ready for review.

To consider

  • How to deal with backcompat of existing message files?
  • How to version goi18n command?
  • Change import path for v2
  • Support vgo?

fixes #88
fixes #87
fixes #85
fixes #82
fixes #76
fixes #64
fixes #56
fixes #44
fixes #30
fixes #27
fixes #8

@codecov
Copy link

codecov bot commented Apr 5, 2018

Codecov Report

Merging #92 into master will increase coverage by 3.2%.
The diff coverage is 66.37%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #92     +/-   ##
=========================================
+ Coverage   59.92%   63.13%   +3.2%     
=========================================
  Files          14       27     +13     
  Lines        1138     2268   +1130     
=========================================
+ Hits          682     1432    +750     
- Misses        424      762    +338     
- Partials       32       74     +42
Impacted Files Coverage Δ
v2/internal/message_template.go 0% <0%> (ø)
v2/internal/message.go 0% <0%> (ø)
v2/internal/parse.go 0% <0%> (ø)
v2/internal/plural/rule_gen.go 100% <100%> (ø)
v2/internal/plural/rule.go 100% <100%> (ø)
v2/goi18n/main.go 35.38% <35.38%> (ø)
v2/goi18n/extract_command.go 59.45% <59.45%> (ø)
v2/i18n/bundle.go 66.07% <66.07%> (ø)
v2/internal/plural/operands.go 67.64% <67.64%> (ø)
v2/goi18n/merge_command.go 74.43% <74.43%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1e1f7b...a83f9c1. Read the comment docs.

@nicksnyder nicksnyder changed the title V2 beta V2 Apr 10, 2018
@bep
Copy link
Contributor

bep commented Apr 10, 2018

This looks really, really good. I assume that old bundle files will still work after this?

@nicksnyder
Copy link
Owner Author

nicksnyder commented Apr 10, 2018

I assume that old bundle files will still work after this?

No, I have not spent any time thinking about backcompat yet; I designed this fresh.

I think the best way to deal with old message files is to run a one-time conversion via goi18n. Thoughts?

@bep
Copy link
Contributor

bep commented Apr 10, 2018

I think the best way to deal with old message files is to run a one-time conversion via goi18n. Thoughts?

I think there should be a really good reason to break the file formats.

Coming from Hugo, I mainly want this for the "non-globals". If I have to somehow handle migration of all the sites in the wild (I know I can probably point to some tool out there, but I still have to document it and answer questions from confused people), I may think twice before doing the upgrade.

@mh-cbon
Copy link
Contributor

mh-cbon commented Apr 10, 2018

How to version goi18n command?

might this help golang/dep#221

@bep
Copy link
Contributor

bep commented Apr 10, 2018

I think there should be a really good reason to break the file formats.

Note that I'm happy to do the work if it's a really good reason to, i.e. the change itself adds really useful stuff. But not just for vanity reasons ("this looks prettier").

@nicksnyder
Copy link
Owner Author

I think there should be a really good reason to break the file formats.
But not just for vanity reasons ("this looks prettier").

The file format (and everything else) in this PR was created from first principals, given the knowledge of file formats that we want to support, and feedback from users like this. There are also new things, like keeping track of the original content hash to know if a source translation was edited.

Supporting multiple file formats in general is confusing to users and a pain to maintain/test/document. The fact that v1 has multiple formats is an artifact of not understanding the limitations of alternative encodings (e.g. toml) from the beginning of the library.

How to deal with backwards compatibility is simply something that I have not thought about yet because backcompat was not a goal of mine when designing v2, but I will think about it soon. Of course I want to make the transition to v2 as easy as possible.

@nicksnyder
Copy link
Owner Author

@bep the runtime library can load message files from v1, and message files from v1 will automatically get reformated to the new structure the first time goi18n merge is run.

@nicksnyder nicksnyder merged commit 2512db5 into master Apr 15, 2018
@nicksnyder nicksnyder deleted the v2-beta branch April 15, 2018 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment