From f0cd8fa6f1eef53b5851f290e1240d7700856095 Mon Sep 17 00:00:00 2001 From: Nick Snyder Date: Tue, 30 Jan 2024 21:41:34 -0800 Subject: [PATCH] Remove v2 directory (#318) --- .github/README.zh-Hans.md | 14 +++++++------- .github/workflows/build.yml | 3 --- .github/workflows/golangci-lint.yml | 1 - .github/workflows/goreleaser.yml | 1 - .github/workflows/lsif-go.yml | 3 +-- .gitignore | 8 ++++---- v2/.goreleaser.yml => .goreleaser.yml | 0 CHANGELOG.md | 2 +- README.md | 12 ++++++------ {v2/example => example}/README.md | 0 {v2/example => example}/active.en.toml | 0 {v2/example => example}/active.es.toml | 0 {v2/example => example}/main.go | 0 v2/go.mod => go.mod | 0 v2/go.sum => go.sum | 0 {v2/goi18n => goi18n}/active.en.toml | 0 {v2/goi18n => goi18n}/common_test.go | 0 {v2/goi18n => goi18n}/extract_command.go | 0 {v2/goi18n => goi18n}/extract_command_test.go | 0 {v2/goi18n => goi18n}/main.go | 0 {v2/goi18n => goi18n}/main_test.go | 0 {v2/goi18n => goi18n}/marshal.go | 0 {v2/goi18n => goi18n}/marshal_test.go | 0 {v2/goi18n => goi18n}/merge_command.go | 0 {v2/goi18n => goi18n}/merge_command_test.go | 0 {v2/i18n => i18n}/bundle.go | 0 {v2/i18n => i18n}/bundle_test.go | 0 {v2/i18n => i18n}/bundlefs.go | 0 {v2/i18n => i18n}/doc.go | 0 {v2/i18n => i18n}/example_test.go | 0 {v2/i18n => i18n}/language_test.go | 0 {v2/i18n => i18n}/localizer.go | 0 {v2/i18n => i18n}/localizer_test.go | 0 {v2/i18n => i18n}/message.go | 0 {v2/i18n => i18n}/message_template.go | 0 {v2/i18n => i18n}/message_template_test.go | 0 {v2/i18n => i18n}/message_test.go | 0 {v2/i18n => i18n}/parse.go | 0 {v2/i18n => i18n}/parse_test.go | 0 {v2/i18n => i18n}/template/identity_parser.go | 0 {v2/i18n => i18n}/template/parser.go | 0 {v2/i18n => i18n}/template/text_parser.go | 0 {v2/internal => internal}/plural/codegen/README.md | 0 .../plural/codegen/generate.sh | 0 {v2/internal => internal}/plural/codegen/main.go | 0 .../plural/codegen/plurals.xml | 0 {v2/internal => internal}/plural/codegen/xml.go | 0 {v2/internal => internal}/plural/doc.go | 0 {v2/internal => internal}/plural/form.go | 0 {v2/internal => internal}/plural/operands.go | 0 {v2/internal => internal}/plural/operands_test.go | 0 {v2/internal => internal}/plural/rule.go | 0 {v2/internal => internal}/plural/rule_gen.go | 0 {v2/internal => internal}/plural/rule_gen_test.go | 0 {v2/internal => internal}/plural/rule_test.go | 0 {v2/internal => internal}/plural/rules.go | 0 {v2/internal => internal}/plural/rules_test.go | 0 {v2/internal => internal}/template.go | 0 {v2/internal => internal}/template_test.go | 0 59 files changed, 19 insertions(+), 25 deletions(-) rename v2/.goreleaser.yml => .goreleaser.yml (100%) rename {v2/example => example}/README.md (100%) rename {v2/example => example}/active.en.toml (100%) rename {v2/example => example}/active.es.toml (100%) rename {v2/example => example}/main.go (100%) rename v2/go.mod => go.mod (100%) rename v2/go.sum => go.sum (100%) rename {v2/goi18n => goi18n}/active.en.toml (100%) rename {v2/goi18n => goi18n}/common_test.go (100%) rename {v2/goi18n => goi18n}/extract_command.go (100%) rename {v2/goi18n => goi18n}/extract_command_test.go (100%) rename {v2/goi18n => goi18n}/main.go (100%) rename {v2/goi18n => goi18n}/main_test.go (100%) rename {v2/goi18n => goi18n}/marshal.go (100%) rename {v2/goi18n => goi18n}/marshal_test.go (100%) rename {v2/goi18n => goi18n}/merge_command.go (100%) rename {v2/goi18n => goi18n}/merge_command_test.go (100%) rename {v2/i18n => i18n}/bundle.go (100%) rename {v2/i18n => i18n}/bundle_test.go (100%) rename {v2/i18n => i18n}/bundlefs.go (100%) rename {v2/i18n => i18n}/doc.go (100%) rename {v2/i18n => i18n}/example_test.go (100%) rename {v2/i18n => i18n}/language_test.go (100%) rename {v2/i18n => i18n}/localizer.go (100%) rename {v2/i18n => i18n}/localizer_test.go (100%) rename {v2/i18n => i18n}/message.go (100%) rename {v2/i18n => i18n}/message_template.go (100%) rename {v2/i18n => i18n}/message_template_test.go (100%) rename {v2/i18n => i18n}/message_test.go (100%) rename {v2/i18n => i18n}/parse.go (100%) rename {v2/i18n => i18n}/parse_test.go (100%) rename {v2/i18n => i18n}/template/identity_parser.go (100%) rename {v2/i18n => i18n}/template/parser.go (100%) rename {v2/i18n => i18n}/template/text_parser.go (100%) rename {v2/internal => internal}/plural/codegen/README.md (100%) rename {v2/internal => internal}/plural/codegen/generate.sh (100%) rename {v2/internal => internal}/plural/codegen/main.go (100%) rename {v2/internal => internal}/plural/codegen/plurals.xml (100%) rename {v2/internal => internal}/plural/codegen/xml.go (100%) rename {v2/internal => internal}/plural/doc.go (100%) rename {v2/internal => internal}/plural/form.go (100%) rename {v2/internal => internal}/plural/operands.go (100%) rename {v2/internal => internal}/plural/operands_test.go (100%) rename {v2/internal => internal}/plural/rule.go (100%) rename {v2/internal => internal}/plural/rule_gen.go (100%) rename {v2/internal => internal}/plural/rule_gen_test.go (100%) rename {v2/internal => internal}/plural/rule_test.go (100%) rename {v2/internal => internal}/plural/rules.go (100%) rename {v2/internal => internal}/plural/rules_test.go (100%) rename {v2/internal => internal}/template.go (100%) rename {v2/internal => internal}/template_test.go (100%) diff --git a/.github/README.zh-Hans.md b/.github/README.zh-Hans.md index ba37a579..bec8b142 100644 --- a/.github/README.zh-Hans.md +++ b/.github/README.zh-Hans.md @@ -4,7 +4,7 @@ go-i18n 是一个帮助您将 Go 程序翻译成多种语言的 Go [包](#packag - 支持 [Unicode Common Locale Data Repository (CLDR)](https://www.unicode.org/cldr/charts/28/supplemental/language_plural_rules.html) 中所有 200 多种语言的[复数字符串](http://cldr.unicode.org/index/cldr-spec/plural-rules)。 - - 代码和测试是基于 [CLDR 数据](http://cldr.unicode.org/index/downloads)[自动生成](https://github.com/nicksnyder/go-i18n/tree/main/v2/internal/plural/codegen)的。 + - 代码和测试是基于 [CLDR 数据](http://cldr.unicode.org/index/downloads)[自动生成](https://github.com/nicksnyder/go-i18n/tree/main/internal/plural/codegen)的。 - 使用 [text/template](http://golang.org/pkg/text/template/) 语法支持带有命名变量的字符串。 - 支持所有格式的消息文件(例如:JSON、TOML、YAML)。 @@ -18,7 +18,7 @@ go-i18n 是一个帮助您将 Go 程序翻译成多种语言的 Go [包](#packag ## i18n 包 -[![GoDoc](https://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n) +[![GoDoc](https://pkg.go.dev/github.com/nicksnyder/go-i18n?status.svg)](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2/i18n) i18n 包支持根据一组语言环境首选项来查找消息。 @@ -77,7 +77,7 @@ localizer.Localize(&i18n.LocalizeConfig{ ## goi18n 命令 -[![GoDoc](https://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](https://godoc.org/github.com/nicksnyder/go-i18n/v2/goi18n) +[![GoDoc](https://pkg.go.dev/github.com/nicksnyder/go-i18n?status.svg)](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2/goi18n) goi18n 命令管理 i18n 包所使用的消息文件。 @@ -138,10 +138,10 @@ other = "{{.Name}} has {{.Count}} cats." ## 进一步的信息和示例: -- 阅读[文档](https://godoc.org/github.com/nicksnyder/go-i18n/v2)。 -- 查看[代码示例](https://github.com/nicksnyder/go-i18n/blob/main/v2/i18n/example_test.go)和 - [测试](https://github.com/nicksnyder/go-i18n/blob/main/v2/i18n/localizer_test.go)。 -- 查看示例[程序](https://github.com/nicksnyder/go-i18n/tree/main/v2/example)。 +- 阅读[文档](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2)。 +- 查看[代码示例](https://github.com/nicksnyder/go-i18n/blob/main/i18n/example_test.go)和 + [测试](https://github.com/nicksnyder/go-i18n/blob/main/i18n/localizer_test.go)。 +- 查看示例[程序](https://github.com/nicksnyder/go-i18n/tree/main/example)。 ## 许可证 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c96785ff..fb2c9f66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,9 +19,7 @@ jobs: with: version: latest args: release --rm-dist --snapshot - workdir: v2 - name: Test - working-directory: v2 run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... - name: Upload coverage uses: codecov/codecov-action@v3 @@ -37,7 +35,6 @@ jobs: - name: Git checkout uses: actions/checkout@v3 - name: Build and test - working-directory: v2 run: | go get ./... go test -race ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index f90263c0..3c0f0a68 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,4 +22,3 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.55 - working-directory: v2 diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 3148e4d8..c1b04ee0 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -25,7 +25,6 @@ jobs: with: version: latest args: release --rm-dist - workdir: v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lsif-go.yml b/.github/workflows/lsif-go.yml index 7e56f795..d5d8e107 100644 --- a/.github/workflows/lsif-go.yml +++ b/.github/workflows/lsif-go.yml @@ -10,7 +10,6 @@ jobs: - uses: actions/checkout@v1 - name: Generate LSIF data run: lsif-go - working-directory: v2 - name: Upload LSIF data to Sourcegraph.com run: src lsif upload -github-token=${{ secrets.GITHUB_TOKEN }} -ignore-upload-failure - working-directory: v2 + diff --git a/.gitignore b/.gitignore index 6685f2df..34860452 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ output/ *.test *.swp -v2/example/example -v2/goi18n/goi18n -v2/dist/ -v2/coverage.txt +example/example +goi18n/goi18n +dist/ +coverage.txt diff --git a/v2/.goreleaser.yml b/.goreleaser.yml similarity index 100% rename from v2/.goreleaser.yml rename to .goreleaser.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 6496aab1..fb95d596 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ v2 is rewrite of the API from first principals to make it more idiomatic Go, and ### Upgrading from v1 The i18n package in v2 is completely different than v1. -Refer to the [documentation](https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n) and [README](https://github.com/nicksnyder/go-i18n/blob/master/README.md) for guidance. +Refer to the [documentation](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2/i18n) and [README](https://github.com/nicksnyder/go-i18n/blob/master/README.md) for guidance. The goi18n command has similarities and differences: diff --git a/README.md b/README.md index de9ebca1..eba36968 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ go-i18n is a Go [package](#package-i18n) and a [command](#command-goi18n) that helps you translate Go programs into multiple languages. - Supports [pluralized strings](http://cldr.unicode.org/index/cldr-spec/plural-rules) for all 200+ languages in the [Unicode Common Locale Data Repository (CLDR)](https://www.unicode.org/cldr/charts/28/supplemental/language_plural_rules.html). - - Code and tests are [automatically generated](https://github.com/nicksnyder/go-i18n/tree/main/v2/internal/plural/codegen) from [CLDR data](http://cldr.unicode.org/index/downloads). + - Code and tests are [automatically generated](https://github.com/nicksnyder/go-i18n/tree/main/internal/plural/codegen) from [CLDR data](http://cldr.unicode.org/index/downloads). - 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). @@ -16,7 +16,7 @@ go-i18n is a Go [package](#package-i18n) and a [command](#command-goi18n) that h ## Package i18n -[![GoDoc](https://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n) +[![GoDoc](https://pkg.go.dev/github.com/nicksnyder/go-i18n?status.svg)](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2/i18n) The i18n package provides support for looking up messages according to a set of locale preferences. @@ -74,7 +74,7 @@ localizer.Localize(&i18n.LocalizeConfig{ ``` ## Command goi18n -[![GoDoc](https://godoc.org/github.com/nicksnyder/go-i18n?status.svg)](https://godoc.org/github.com/nicksnyder/go-i18n/v2/goi18n) +[![GoDoc](https://pkg.go.dev/github.com/nicksnyder/go-i18n?status.svg)](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2/goi18n) The goi18n command manages message files used by the i18n package. @@ -134,9 +134,9 @@ If you have added new messages to your program: ## For more information and examples: -- Read the [documentation](https://godoc.org/github.com/nicksnyder/go-i18n/v2). -- Look at the [code examples](https://github.com/nicksnyder/go-i18n/blob/main/v2/i18n/example_test.go) and [tests](https://github.com/nicksnyder/go-i18n/blob/main/v2/i18n/localizer_test.go). -- Look at an example [application](https://github.com/nicksnyder/go-i18n/tree/main/v2/example). +- Read the [documentation](https://pkg.go.dev/github.com/nicksnyder/go-i18n/v2). +- Look at the [code examples](https://github.com/nicksnyder/go-i18n/blob/main/i18n/example_test.go) and [tests](https://github.com/nicksnyder/go-i18n/blob/main/i18n/localizer_test.go). +- Look at an example [application](https://github.com/nicksnyder/go-i18n/tree/main/example). ## License diff --git a/v2/example/README.md b/example/README.md similarity index 100% rename from v2/example/README.md rename to example/README.md diff --git a/v2/example/active.en.toml b/example/active.en.toml similarity index 100% rename from v2/example/active.en.toml rename to example/active.en.toml diff --git a/v2/example/active.es.toml b/example/active.es.toml similarity index 100% rename from v2/example/active.es.toml rename to example/active.es.toml diff --git a/v2/example/main.go b/example/main.go similarity index 100% rename from v2/example/main.go rename to example/main.go diff --git a/v2/go.mod b/go.mod similarity index 100% rename from v2/go.mod rename to go.mod diff --git a/v2/go.sum b/go.sum similarity index 100% rename from v2/go.sum rename to go.sum diff --git a/v2/goi18n/active.en.toml b/goi18n/active.en.toml similarity index 100% rename from v2/goi18n/active.en.toml rename to goi18n/active.en.toml diff --git a/v2/goi18n/common_test.go b/goi18n/common_test.go similarity index 100% rename from v2/goi18n/common_test.go rename to goi18n/common_test.go diff --git a/v2/goi18n/extract_command.go b/goi18n/extract_command.go similarity index 100% rename from v2/goi18n/extract_command.go rename to goi18n/extract_command.go diff --git a/v2/goi18n/extract_command_test.go b/goi18n/extract_command_test.go similarity index 100% rename from v2/goi18n/extract_command_test.go rename to goi18n/extract_command_test.go diff --git a/v2/goi18n/main.go b/goi18n/main.go similarity index 100% rename from v2/goi18n/main.go rename to goi18n/main.go diff --git a/v2/goi18n/main_test.go b/goi18n/main_test.go similarity index 100% rename from v2/goi18n/main_test.go rename to goi18n/main_test.go diff --git a/v2/goi18n/marshal.go b/goi18n/marshal.go similarity index 100% rename from v2/goi18n/marshal.go rename to goi18n/marshal.go diff --git a/v2/goi18n/marshal_test.go b/goi18n/marshal_test.go similarity index 100% rename from v2/goi18n/marshal_test.go rename to goi18n/marshal_test.go diff --git a/v2/goi18n/merge_command.go b/goi18n/merge_command.go similarity index 100% rename from v2/goi18n/merge_command.go rename to goi18n/merge_command.go diff --git a/v2/goi18n/merge_command_test.go b/goi18n/merge_command_test.go similarity index 100% rename from v2/goi18n/merge_command_test.go rename to goi18n/merge_command_test.go diff --git a/v2/i18n/bundle.go b/i18n/bundle.go similarity index 100% rename from v2/i18n/bundle.go rename to i18n/bundle.go diff --git a/v2/i18n/bundle_test.go b/i18n/bundle_test.go similarity index 100% rename from v2/i18n/bundle_test.go rename to i18n/bundle_test.go diff --git a/v2/i18n/bundlefs.go b/i18n/bundlefs.go similarity index 100% rename from v2/i18n/bundlefs.go rename to i18n/bundlefs.go diff --git a/v2/i18n/doc.go b/i18n/doc.go similarity index 100% rename from v2/i18n/doc.go rename to i18n/doc.go diff --git a/v2/i18n/example_test.go b/i18n/example_test.go similarity index 100% rename from v2/i18n/example_test.go rename to i18n/example_test.go diff --git a/v2/i18n/language_test.go b/i18n/language_test.go similarity index 100% rename from v2/i18n/language_test.go rename to i18n/language_test.go diff --git a/v2/i18n/localizer.go b/i18n/localizer.go similarity index 100% rename from v2/i18n/localizer.go rename to i18n/localizer.go diff --git a/v2/i18n/localizer_test.go b/i18n/localizer_test.go similarity index 100% rename from v2/i18n/localizer_test.go rename to i18n/localizer_test.go diff --git a/v2/i18n/message.go b/i18n/message.go similarity index 100% rename from v2/i18n/message.go rename to i18n/message.go diff --git a/v2/i18n/message_template.go b/i18n/message_template.go similarity index 100% rename from v2/i18n/message_template.go rename to i18n/message_template.go diff --git a/v2/i18n/message_template_test.go b/i18n/message_template_test.go similarity index 100% rename from v2/i18n/message_template_test.go rename to i18n/message_template_test.go diff --git a/v2/i18n/message_test.go b/i18n/message_test.go similarity index 100% rename from v2/i18n/message_test.go rename to i18n/message_test.go diff --git a/v2/i18n/parse.go b/i18n/parse.go similarity index 100% rename from v2/i18n/parse.go rename to i18n/parse.go diff --git a/v2/i18n/parse_test.go b/i18n/parse_test.go similarity index 100% rename from v2/i18n/parse_test.go rename to i18n/parse_test.go diff --git a/v2/i18n/template/identity_parser.go b/i18n/template/identity_parser.go similarity index 100% rename from v2/i18n/template/identity_parser.go rename to i18n/template/identity_parser.go diff --git a/v2/i18n/template/parser.go b/i18n/template/parser.go similarity index 100% rename from v2/i18n/template/parser.go rename to i18n/template/parser.go diff --git a/v2/i18n/template/text_parser.go b/i18n/template/text_parser.go similarity index 100% rename from v2/i18n/template/text_parser.go rename to i18n/template/text_parser.go diff --git a/v2/internal/plural/codegen/README.md b/internal/plural/codegen/README.md similarity index 100% rename from v2/internal/plural/codegen/README.md rename to internal/plural/codegen/README.md diff --git a/v2/internal/plural/codegen/generate.sh b/internal/plural/codegen/generate.sh similarity index 100% rename from v2/internal/plural/codegen/generate.sh rename to internal/plural/codegen/generate.sh diff --git a/v2/internal/plural/codegen/main.go b/internal/plural/codegen/main.go similarity index 100% rename from v2/internal/plural/codegen/main.go rename to internal/plural/codegen/main.go diff --git a/v2/internal/plural/codegen/plurals.xml b/internal/plural/codegen/plurals.xml similarity index 100% rename from v2/internal/plural/codegen/plurals.xml rename to internal/plural/codegen/plurals.xml diff --git a/v2/internal/plural/codegen/xml.go b/internal/plural/codegen/xml.go similarity index 100% rename from v2/internal/plural/codegen/xml.go rename to internal/plural/codegen/xml.go diff --git a/v2/internal/plural/doc.go b/internal/plural/doc.go similarity index 100% rename from v2/internal/plural/doc.go rename to internal/plural/doc.go diff --git a/v2/internal/plural/form.go b/internal/plural/form.go similarity index 100% rename from v2/internal/plural/form.go rename to internal/plural/form.go diff --git a/v2/internal/plural/operands.go b/internal/plural/operands.go similarity index 100% rename from v2/internal/plural/operands.go rename to internal/plural/operands.go diff --git a/v2/internal/plural/operands_test.go b/internal/plural/operands_test.go similarity index 100% rename from v2/internal/plural/operands_test.go rename to internal/plural/operands_test.go diff --git a/v2/internal/plural/rule.go b/internal/plural/rule.go similarity index 100% rename from v2/internal/plural/rule.go rename to internal/plural/rule.go diff --git a/v2/internal/plural/rule_gen.go b/internal/plural/rule_gen.go similarity index 100% rename from v2/internal/plural/rule_gen.go rename to internal/plural/rule_gen.go diff --git a/v2/internal/plural/rule_gen_test.go b/internal/plural/rule_gen_test.go similarity index 100% rename from v2/internal/plural/rule_gen_test.go rename to internal/plural/rule_gen_test.go diff --git a/v2/internal/plural/rule_test.go b/internal/plural/rule_test.go similarity index 100% rename from v2/internal/plural/rule_test.go rename to internal/plural/rule_test.go diff --git a/v2/internal/plural/rules.go b/internal/plural/rules.go similarity index 100% rename from v2/internal/plural/rules.go rename to internal/plural/rules.go diff --git a/v2/internal/plural/rules_test.go b/internal/plural/rules_test.go similarity index 100% rename from v2/internal/plural/rules_test.go rename to internal/plural/rules_test.go diff --git a/v2/internal/template.go b/internal/template.go similarity index 100% rename from v2/internal/template.go rename to internal/template.go diff --git a/v2/internal/template_test.go b/internal/template_test.go similarity index 100% rename from v2/internal/template_test.go rename to internal/template_test.go