From 0c6ce6ac1e8c119993c3d5638af4f7cd67ff068a Mon Sep 17 00:00:00 2001 From: Nick Snyder Date: Tue, 11 Jun 2019 10:06:53 -0700 Subject: [PATCH] Move code to v2 subfolder for greater compatibility (#187) --- .gitignore | 6 +++--- .golangci.yml | 6 +++--- .travis.yml | 7 ++----- README.md | 10 +++++----- dev.md | 4 ++-- .goreleaser.yml => v2/.goreleaser.yml | 0 {example => v2/example}/README.md | 0 {example => v2/example}/active.en.toml | 0 {example => v2/example}/active.es.toml | 0 {example => v2/example}/main.go | 0 go.mod => v2/go.mod | 0 go.sum => v2/go.sum | 0 {goi18n => v2/goi18n}/active.en.toml | 0 {goi18n => v2/goi18n}/common_test.go | 0 {goi18n => v2/goi18n}/extract_command.go | 0 {goi18n => v2/goi18n}/extract_command_test.go | 0 {goi18n => v2/goi18n}/main.go | 0 {goi18n => v2/goi18n}/main_test.go | 0 {goi18n => v2/goi18n}/marshal.go | 0 {goi18n => v2/goi18n}/merge_command.go | 0 {goi18n => v2/goi18n}/merge_command_test.go | 0 {i18n => v2/i18n}/bundle.go | 0 {i18n => v2/i18n}/bundle_test.go | 0 {i18n => v2/i18n}/doc.go | 0 {i18n => v2/i18n}/example_test.go | 0 {i18n => v2/i18n}/language_test.go | 0 {i18n => v2/i18n}/localizer.go | 0 {i18n => v2/i18n}/localizer_test.go | 0 {i18n => v2/i18n}/message.go | 0 {i18n => v2/i18n}/message_template.go | 0 {i18n => v2/i18n}/message_template_test.go | 0 {i18n => v2/i18n}/message_test.go | 0 {i18n => v2/i18n}/parse.go | 0 {i18n => v2/i18n}/parse_test.go | 0 {internal => v2/internal}/plural/codegen/generate.sh | 0 {internal => v2/internal}/plural/codegen/main.go | 0 {internal => v2/internal}/plural/codegen/plurals.xml | 0 {internal => v2/internal}/plural/codegen/xml.go | 0 {internal => v2/internal}/plural/doc.go | 0 {internal => v2/internal}/plural/form.go | 0 {internal => v2/internal}/plural/operands.go | 0 {internal => v2/internal}/plural/operands_test.go | 0 {internal => v2/internal}/plural/rule.go | 0 {internal => v2/internal}/plural/rule_gen.go | 0 {internal => v2/internal}/plural/rule_gen_test.go | 0 {internal => v2/internal}/plural/rule_test.go | 0 {internal => v2/internal}/plural/rules.go | 0 {internal => v2/internal}/plural/rules_test.go | 0 {internal => v2/internal}/template.go | 0 {internal => v2/internal}/template_test.go | 0 50 files changed, 15 insertions(+), 18 deletions(-) rename .goreleaser.yml => v2/.goreleaser.yml (100%) rename {example => v2/example}/README.md (100%) rename {example => v2/example}/active.en.toml (100%) rename {example => v2/example}/active.es.toml (100%) rename {example => v2/example}/main.go (100%) rename go.mod => v2/go.mod (100%) rename go.sum => v2/go.sum (100%) rename {goi18n => v2/goi18n}/active.en.toml (100%) rename {goi18n => v2/goi18n}/common_test.go (100%) rename {goi18n => v2/goi18n}/extract_command.go (100%) rename {goi18n => v2/goi18n}/extract_command_test.go (100%) rename {goi18n => v2/goi18n}/main.go (100%) rename {goi18n => v2/goi18n}/main_test.go (100%) rename {goi18n => v2/goi18n}/marshal.go (100%) rename {goi18n => v2/goi18n}/merge_command.go (100%) rename {goi18n => v2/goi18n}/merge_command_test.go (100%) rename {i18n => v2/i18n}/bundle.go (100%) rename {i18n => v2/i18n}/bundle_test.go (100%) rename {i18n => v2/i18n}/doc.go (100%) rename {i18n => v2/i18n}/example_test.go (100%) rename {i18n => v2/i18n}/language_test.go (100%) rename {i18n => v2/i18n}/localizer.go (100%) rename {i18n => v2/i18n}/localizer_test.go (100%) rename {i18n => v2/i18n}/message.go (100%) rename {i18n => v2/i18n}/message_template.go (100%) rename {i18n => v2/i18n}/message_template_test.go (100%) rename {i18n => v2/i18n}/message_test.go (100%) rename {i18n => v2/i18n}/parse.go (100%) rename {i18n => v2/i18n}/parse_test.go (100%) rename {internal => v2/internal}/plural/codegen/generate.sh (100%) rename {internal => v2/internal}/plural/codegen/main.go (100%) rename {internal => v2/internal}/plural/codegen/plurals.xml (100%) rename {internal => v2/internal}/plural/codegen/xml.go (100%) rename {internal => v2/internal}/plural/doc.go (100%) rename {internal => v2/internal}/plural/form.go (100%) rename {internal => v2/internal}/plural/operands.go (100%) rename {internal => v2/internal}/plural/operands_test.go (100%) rename {internal => v2/internal}/plural/rule.go (100%) rename {internal => v2/internal}/plural/rule_gen.go (100%) rename {internal => v2/internal}/plural/rule_gen_test.go (100%) rename {internal => v2/internal}/plural/rule_test.go (100%) rename {internal => v2/internal}/plural/rules.go (100%) rename {internal => v2/internal}/plural/rules_test.go (100%) rename {internal => v2/internal}/template.go (100%) rename {internal => v2/internal}/template_test.go (100%) diff --git a/.gitignore b/.gitignore index 281914e6..a762d332 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ output/ *.test *.swp -example/example -goi18n/goi18n +v2/example/example +v2/goi18n/goi18n -dist/ +v2/dist/ diff --git a/.golangci.yml b/.golangci.yml index 55e66864..c0435fb8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,8 @@ # https://github.com/golangci/golangci/wiki/Configuration -service: - prepare: - - go get -t ./... +# service: +# prepare: +# - go get -t ./... linters: enable: - gofmt diff --git a/.travis.yml b/.travis.yml index ec9b5bd1..7ce55bcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,8 @@ matrix: - go: 1.12.x env: GO111MODULE=on COVER='-coverprofile=coverage.txt -covermode=atomic' -install: - - go get -t -v ./... - script: - - go test -race $COVER ./... + - cd v2; go test -race $COVER ./... after_success: - bash <(curl -s https://codecov.io/bash) @@ -19,7 +16,7 @@ after_success: deploy: - provider: script skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash + script: cd v2; curl -sL https://git.io/goreleaser | bash on: tags: true condition: $TRAVIS_OS_NAME = linux diff --git a/README.md b/README.md index ce38b4a7..2d851a02 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ go-i18n is a Go [package](#package-i18n) and a [command](#command-goi18n) that h - Supports strings with named variables using [text/template](http://golang.org/pkg/text/template/) syntax. - Supports message files of any format (e.g. JSON, TOML, YAML). -## Package i18n [![GoDoc](http://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](http://godoc.org/github.com/nicksnyder/go-i18n/i18n) +## Package i18n [![GoDoc](http://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](http://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n) The i18n package provides support for looking up messages according to a set of locale preferences. @@ -55,7 +55,7 @@ localizer.Localize(&i18n.LocalizeConfig{ }) // Nick has 2 cats. ``` -## Command goi18n [![GoDoc](http://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](http://godoc.org/github.com/nicksnyder/go-i18n/goi18n) +## Command goi18n [![GoDoc](http://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](http://godoc.org/github.com/nicksnyder/go-i18n/v2/goi18n) The goi18n command manages message files used by the i18n package. @@ -115,9 +115,9 @@ If you have added new messages to your program: ## For more information and examples: -- Read the [documentation](http://godoc.org/github.com/nicksnyder/go-i18n/). -- Look at the [code examples](https://github.com/nicksnyder/go-i18n/blob/master/i18n/example_test.go) and [tests](https://github.com/nicksnyder/go-i18n/blob/master/i18n/localizer_test.go). -- Look at an example [application](https://github.com/nicksnyder/go-i18n/tree/master/example). +- Read the [documentation](http://godoc.org/github.com/nicksnyder/go-i18n/v2). +- Look at the [code examples](https://github.com/nicksnyder/go-i18n/blob/master/v2/i18n/example_test.go) and [tests](https://github.com/nicksnyder/go-i18n/blob/master/i18n/v2/localizer_test.go). +- Look at an example [application](https://github.com/nicksnyder/go-i18n/tree/master/v2/example). ## License diff --git a/dev.md b/dev.md index d0210bb8..f21dd611 100644 --- a/dev.md +++ b/dev.md @@ -4,5 +4,5 @@ 1. Go to http://cldr.unicode.org/index/downloads to find the latest version. 1. Download the latest version of cldr-common (e.g. http://unicode.org/Public/cldr/33/cldr-common-33.0.zip) -1. Unzip and copy `common/supplemental/plurals.xml` to `i18n/internal/plural/codegen/plurals.xml` -1. Run `generate.sh` in `i18n/internal/plural/codegen/` +1. Unzip and copy `v2/common/supplemental/plurals.xml` to `v2/i18n/internal/plural/codegen/plurals.xml` +1. Run `generate.sh` in `v2/i18n/internal/plural/codegen/` diff --git a/.goreleaser.yml b/v2/.goreleaser.yml similarity index 100% rename from .goreleaser.yml rename to v2/.goreleaser.yml diff --git a/example/README.md b/v2/example/README.md similarity index 100% rename from example/README.md rename to v2/example/README.md diff --git a/example/active.en.toml b/v2/example/active.en.toml similarity index 100% rename from example/active.en.toml rename to v2/example/active.en.toml diff --git a/example/active.es.toml b/v2/example/active.es.toml similarity index 100% rename from example/active.es.toml rename to v2/example/active.es.toml diff --git a/example/main.go b/v2/example/main.go similarity index 100% rename from example/main.go rename to v2/example/main.go diff --git a/go.mod b/v2/go.mod similarity index 100% rename from go.mod rename to v2/go.mod diff --git a/go.sum b/v2/go.sum similarity index 100% rename from go.sum rename to v2/go.sum diff --git a/goi18n/active.en.toml b/v2/goi18n/active.en.toml similarity index 100% rename from goi18n/active.en.toml rename to v2/goi18n/active.en.toml diff --git a/goi18n/common_test.go b/v2/goi18n/common_test.go similarity index 100% rename from goi18n/common_test.go rename to v2/goi18n/common_test.go diff --git a/goi18n/extract_command.go b/v2/goi18n/extract_command.go similarity index 100% rename from goi18n/extract_command.go rename to v2/goi18n/extract_command.go diff --git a/goi18n/extract_command_test.go b/v2/goi18n/extract_command_test.go similarity index 100% rename from goi18n/extract_command_test.go rename to v2/goi18n/extract_command_test.go diff --git a/goi18n/main.go b/v2/goi18n/main.go similarity index 100% rename from goi18n/main.go rename to v2/goi18n/main.go diff --git a/goi18n/main_test.go b/v2/goi18n/main_test.go similarity index 100% rename from goi18n/main_test.go rename to v2/goi18n/main_test.go diff --git a/goi18n/marshal.go b/v2/goi18n/marshal.go similarity index 100% rename from goi18n/marshal.go rename to v2/goi18n/marshal.go diff --git a/goi18n/merge_command.go b/v2/goi18n/merge_command.go similarity index 100% rename from goi18n/merge_command.go rename to v2/goi18n/merge_command.go diff --git a/goi18n/merge_command_test.go b/v2/goi18n/merge_command_test.go similarity index 100% rename from goi18n/merge_command_test.go rename to v2/goi18n/merge_command_test.go diff --git a/i18n/bundle.go b/v2/i18n/bundle.go similarity index 100% rename from i18n/bundle.go rename to v2/i18n/bundle.go diff --git a/i18n/bundle_test.go b/v2/i18n/bundle_test.go similarity index 100% rename from i18n/bundle_test.go rename to v2/i18n/bundle_test.go diff --git a/i18n/doc.go b/v2/i18n/doc.go similarity index 100% rename from i18n/doc.go rename to v2/i18n/doc.go diff --git a/i18n/example_test.go b/v2/i18n/example_test.go similarity index 100% rename from i18n/example_test.go rename to v2/i18n/example_test.go diff --git a/i18n/language_test.go b/v2/i18n/language_test.go similarity index 100% rename from i18n/language_test.go rename to v2/i18n/language_test.go diff --git a/i18n/localizer.go b/v2/i18n/localizer.go similarity index 100% rename from i18n/localizer.go rename to v2/i18n/localizer.go diff --git a/i18n/localizer_test.go b/v2/i18n/localizer_test.go similarity index 100% rename from i18n/localizer_test.go rename to v2/i18n/localizer_test.go diff --git a/i18n/message.go b/v2/i18n/message.go similarity index 100% rename from i18n/message.go rename to v2/i18n/message.go diff --git a/i18n/message_template.go b/v2/i18n/message_template.go similarity index 100% rename from i18n/message_template.go rename to v2/i18n/message_template.go diff --git a/i18n/message_template_test.go b/v2/i18n/message_template_test.go similarity index 100% rename from i18n/message_template_test.go rename to v2/i18n/message_template_test.go diff --git a/i18n/message_test.go b/v2/i18n/message_test.go similarity index 100% rename from i18n/message_test.go rename to v2/i18n/message_test.go diff --git a/i18n/parse.go b/v2/i18n/parse.go similarity index 100% rename from i18n/parse.go rename to v2/i18n/parse.go diff --git a/i18n/parse_test.go b/v2/i18n/parse_test.go similarity index 100% rename from i18n/parse_test.go rename to v2/i18n/parse_test.go diff --git a/internal/plural/codegen/generate.sh b/v2/internal/plural/codegen/generate.sh similarity index 100% rename from internal/plural/codegen/generate.sh rename to v2/internal/plural/codegen/generate.sh diff --git a/internal/plural/codegen/main.go b/v2/internal/plural/codegen/main.go similarity index 100% rename from internal/plural/codegen/main.go rename to v2/internal/plural/codegen/main.go diff --git a/internal/plural/codegen/plurals.xml b/v2/internal/plural/codegen/plurals.xml similarity index 100% rename from internal/plural/codegen/plurals.xml rename to v2/internal/plural/codegen/plurals.xml diff --git a/internal/plural/codegen/xml.go b/v2/internal/plural/codegen/xml.go similarity index 100% rename from internal/plural/codegen/xml.go rename to v2/internal/plural/codegen/xml.go diff --git a/internal/plural/doc.go b/v2/internal/plural/doc.go similarity index 100% rename from internal/plural/doc.go rename to v2/internal/plural/doc.go diff --git a/internal/plural/form.go b/v2/internal/plural/form.go similarity index 100% rename from internal/plural/form.go rename to v2/internal/plural/form.go diff --git a/internal/plural/operands.go b/v2/internal/plural/operands.go similarity index 100% rename from internal/plural/operands.go rename to v2/internal/plural/operands.go diff --git a/internal/plural/operands_test.go b/v2/internal/plural/operands_test.go similarity index 100% rename from internal/plural/operands_test.go rename to v2/internal/plural/operands_test.go diff --git a/internal/plural/rule.go b/v2/internal/plural/rule.go similarity index 100% rename from internal/plural/rule.go rename to v2/internal/plural/rule.go diff --git a/internal/plural/rule_gen.go b/v2/internal/plural/rule_gen.go similarity index 100% rename from internal/plural/rule_gen.go rename to v2/internal/plural/rule_gen.go diff --git a/internal/plural/rule_gen_test.go b/v2/internal/plural/rule_gen_test.go similarity index 100% rename from internal/plural/rule_gen_test.go rename to v2/internal/plural/rule_gen_test.go diff --git a/internal/plural/rule_test.go b/v2/internal/plural/rule_test.go similarity index 100% rename from internal/plural/rule_test.go rename to v2/internal/plural/rule_test.go diff --git a/internal/plural/rules.go b/v2/internal/plural/rules.go similarity index 100% rename from internal/plural/rules.go rename to v2/internal/plural/rules.go diff --git a/internal/plural/rules_test.go b/v2/internal/plural/rules_test.go similarity index 100% rename from internal/plural/rules_test.go rename to v2/internal/plural/rules_test.go diff --git a/internal/template.go b/v2/internal/template.go similarity index 100% rename from internal/template.go rename to v2/internal/template.go diff --git a/internal/template_test.go b/v2/internal/template_test.go similarity index 100% rename from internal/template_test.go rename to v2/internal/template_test.go