Merge lp:~mvo/snappy/snapy-out-own-xgettext into lp:~snappy-dev/snappy/snappy-moved-to-github
| Status: | Merged |
|---|---|
| Approved by: | John Lenton on 2015-07-24 |
| Approved revision: | 572 |
| Merged at revision: | 608 |
| Proposed branch: | lp:~mvo/snappy/snapy-out-own-xgettext |
| Merge into: | lp:~snappy-dev/snappy/snappy-moved-to-github |
| Diff against target: |
859 lines (+709/-29) 4 files modified
i18n/xgettext-go/main.go (+269/-0) i18n/xgettext-go/main_test.go (+392/-0) po/snappy.pot (+28/-23) update-pot (+20/-6) |
| To merge this branch: | bzr merge lp:~mvo/snappy/snapy-out-own-xgettext |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Vogt | Approve on 2015-07-24 | ||
| John Lenton | 2015-07-02 | Approve on 2015-07-24 | |
|
Review via email:
|
|||
Commit Message
Use a native (go) xgettext to get translation support for go string of the `` type.
Description of the Change
This is a bit of a RFC branch.
It implements a native xgettext to allow us to extract strings that use the `` style. I looked into what it would take to add that to the gettext upstream xgettext.c but that looks like it will be a lot more work. The powerful go ast package makes this pretty straightforward to implement. I send a wishlist bugreport to https:/
| Leo Arias (elopio) wrote : | # |
| Michael Vogt (mvo) wrote : | # |
Thanks for your excellent comments Leo! I think most of this is addressed now (tests are not quite where I want them to be though :/), I wonder if our version should also implement the normalization for the lines,
i.e.
"very-long-line"
is split by gettext into
"very"
"long"
"line"
| John Lenton (chipaca) wrote : | # |
Looks good to go; needs fixing a conflict and then set the commit message (i'll top approve now).
| Snappy Tarmac (snappydevtarmac) wrote : | # |
Attempt to merge into lp:snappy failed due to conflicts:
text conflict in po/snappy.pot
| Snappy Tarmac (snappydevtarmac) wrote : | # |
The attempt to merge lp:~mvo/snappy/snapy-out-own-xgettext into lp:snappy failed. Below is the output from the failed tests.
Checking docs
Checking formatting
Installing godeps
Install golint
Obtaining dependencies
update github.
update github.
github.
update github.
github.
update github.
github.
update github.
github.
update github.
github.
update golang.org/x/crypto failed; trying to fetch newer version
github.
update gopkg.in/check.v1 failed; trying to fetch newer version
golang.org/x/crypto now at 60052bd85f2d912
update gopkg.in/yaml.v2 failed; trying to fetch newer version
gopkg.in/check.v1 now at 64131543e7896d5
gopkg.in/yaml.v2 now at 49c95bdc2184325
Building
Running tests from /tmp/tmp.
=== RUN Test
OK: 16 passed
--- PASS: Test (0.35 seconds)
PASS
coverage: 74.8% of statements
ok launchpad.
=== RUN Test
2015/07/24 12:02:08.786595 common.go:40: PANIC can not set option description for "package name"
OK: 9 passed
--- PASS: Test (0.02 seconds)
PASS
coverage: 20.0% of statements
ok launchpad.
=== RUN Test
OK: 24 passed
--- PASS: Test (0.06 seconds)
PASS
coverage: 100.0% of statements
ok launchpad.
=== RUN Test
OK: 55 passed
--- PASS: Test (0.30 seconds)
PASS
coverage: 81.4% of statements
ok launchpad.
=== RUN Test
OK: 0 passed, 2 skipped
--- PASS: Test (0.01 seconds)
PASS
coverage: 33.3% of statements
ok launchpad.
=== RUN Test
OK: 11 passed
--- PASS: Test (0.00 seconds)
PASS
coverage: 93.4% of statements
ok launchpad.
=== RUN Test
OK: 6 passed
--- PASS: Test (0.00 seconds)
PASS
coverage: 93.5% of statements
ok launchpad.
=== RUN Test
OK: 4 passed
--- PASS: Test (0.00 seconds)
PASS
coverage: 100.0% of statements
ok launchpad.
=== RUN Test
OK: 39 passed
--- PASS: Test (0.35 seconds)
PASS
coverage: 79.1% of statements
ok launchpad.
=== RUN Test
OK: 3 passed
--- PASS: Test (0.00 seconds)
PAS...
| Snappy Tarmac (snappydevtarmac) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.


I think this works for our purposes. We lose some niceties that gettext has, like optional location, sorting the messages and choosing the translators comment tag; but maybe we don't need those. Or are you planning to add more features?
There's one thing that gettext does nicely that I would miss, that's not duplicating the messages with the same string: http:// git.savannah. gnu.org/ cgit/gettext. git/tree/ gettext- tools/tests/ xgettext- 7
I've a comment on the diff.