Merge lp://qastaging/~mterry/snapcraft/gettext into lp://qastaging/~snappy-dev/snapcraft/abandoned-go-trunk

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 7
Merged at revision: 5
Proposed branch: lp://qastaging/~mterry/snapcraft/gettext
Merge into: lp://qastaging/~snappy-dev/snapcraft/abandoned-go-trunk
Diff against target: 371 lines (+229/-6)
14 files modified
cmd/snapcraft/cmd_scratch.go (+6/-2)
cmd/snapcraft/cmd_scratch_info.go (+6/-3)
cmd/snapcraft/main.go (+7/-0)
config/yaml.go (+3/-1)
dependencies.tsv (+2/-0)
gen-coverage.sh (+2/-0)
helpers/dirs.go (+46/-0)
helpers/dirs_test.go (+50/-0)
make-snap (+27/-0)
package.yaml (+7/-0)
po/en_US.po (+16/-0)
po/snapcraft.pot (+34/-0)
run-checks (+7/-0)
update-pot (+16/-0)
To merge this branch: bzr merge lp://qastaging/~mterry/snapcraft/gettext
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+261965@code.qastaging.launchpad.net

Commit message

Add gettext support to snapcraft.

This wasn't an urgent change at all. But I was curious what a gettext-enabled Go project might look like (as Go's build system doesn't seem to cater to data files). Since snapcraft only has a little bit of code and few messages, it was an easy task to tackle.

I chose the "github.com/gosexy/gettext" module based on my research here:
https://bugs.launchpad.net/snappy/+bug/1462085/comments/1

- I added a helpers/dirs.go file to locate our data files at run time (supporting both a snapified mode and a deb mode).

- I added a script to update the pot file and a check in run-checks that makes sure if you change any strings, you know you need to update the pot file.

- I added a dummy package.yaml and a simple make-snap script to make an example snap (I wanted to see what it would look like to distribute the .mo files, plus it's good to be able to make a snap for testing purposes)

- I added a dummy en_US.po null translation just as an example (so I could see *something* installed in the locales folder). We can drop it later when we have real translations.

I don't think we should enable translations in LP yet, since all our strings are provisional. But I just wanted to lay the groundwork.

I tested this locally (locale changing in a snappy system doesn't work?) with a fake translation and it seemed to work.

Description of the change

Add gettext support to snapcraft.

This wasn't an urgent change at all. But I was curious what a gettext-enabled Go project might look like (as Go's build system doesn't seem to cater to data files). Since snapcraft only has a little bit of code and few messages, it was an easy task to tackle.

I chose the "github.com/gosexy/gettext" module based on my research here:
https://bugs.launchpad.net/snappy/+bug/1462085/comments/1

- I added a helpers/dirs.go file to locate our data files at run time (supporting both a snapified mode and a deb mode).

- I added a script to update the pot file and a check in run-checks that makes sure if you change any strings, you know you need to update the pot file.

- I added a dummy package.yaml and a simple make-snap script to make an example snap (I wanted to see what it would look like to distribute the .mo files, plus it's good to be able to make a snap for testing purposes)

- I added a dummy en_US.po null translation just as an example (so I could see *something* installed in the locales folder). We can drop it later when we have real translations.

I don't think we should enable translations in LP yet, since all our strings are provisional. But I just wanted to lay the groundwork.

I tested this locally (locale changing in a snappy system doesn't work?) with a fake translation and it seemed to work.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Hey Michael! This is really great stuff. I used it as the blueprint for snappy and created a lp:~mvo/snappy/snappy-gettext branch. I put some inline comments (mostly because I just write down there whats in my mind) but none of those is important, this is cool stuff and can be merged as it is.

review: Approve
Revision history for this message
Michael Terry (mterry) wrote :

I may steal whatever solution you end up using for snappy to shorten "gettext.Gettext" so something reasonable. But I suppose this verbose version can go in as-is.

I'll top-approve. Your other comments were sensible, but the only one I would act on is the consolidation of two strings into one, and it's not worth a whole bzr commit/push cycle. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches