diff --git a/.gitignore b/.gitignore index 2661785..bc4e07f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ _testmain.go *.exe *.test -*.prof \ No newline at end of file +*.prof +*.coverprofile \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..39b8b92 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: go +go: + - 1.13.4 + - tip +matrix: + allow_failures: + - go: tip + +notifications: + email: + recipients: dean.karn@gmail.com + on_success: change + on_failure: always + +before_install: + - go install github.com/mattn/goveralls + +# Only clone the most recent commit. +git: + depth: 1 + +script: + - go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./... + +after_success: | + [ $TRAVIS_GO_VERSION = 1.13.4 ] && + goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN \ No newline at end of file diff --git a/README.md b/README.md index 2840a7e..071f33a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## universal-translator -![Project status](https://img.shields.io/badge/version-0.16.0-green.svg) -[![Build Status](https://semaphoreci.com/api/v1/joeybloggs/universal-translator/branches/master/badge.svg)](https://semaphoreci.com/joeybloggs/universal-translator) +![Project status](https://img.shields.io/badge/version-0.17.0-green.svg) +[![Build Status](https://travis-ci.org/go-playground/universal-translator.svg?branch=master)](https://travis-ci.org/go-playground/universal-translator) [![Coverage Status](https://coveralls.io/repos/github/go-playground/universal-translator/badge.svg)](https://coveralls.io/github/go-playground/universal-translator) [![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/universal-translator)](https://goreportcard.com/report/github.com/go-playground/universal-translator) [![GoDoc](https://godoc.org/github.com/go-playground/universal-translator?status.svg)](https://godoc.org/github.com/go-playground/universal-translator) @@ -45,9 +45,9 @@ Please see https://godoc.org/github.com/go-playground/universal-translator for u ##### Examples: -- [Basic](https://github.com/go-playground/universal-translator/tree/master/examples/basic) -- [Full - no files](https://github.com/go-playground/universal-translator/tree/master/examples/full-no-files) -- [Full - with files](https://github.com/go-playground/universal-translator/tree/master/examples/full-with-files) +- [Basic](https://github.com/go-playground/universal-translator/tree/master/_examples/basic) +- [Full - no files](https://github.com/go-playground/universal-translator/tree/master/_examples/full-no-files) +- [Full - with files](https://github.com/go-playground/universal-translator/tree/master/_examples/full-with-files) File formatting -------------- @@ -56,10 +56,10 @@ they are only separated for easy viewing. ##### Examples: -- [Formats](https://github.com/go-playground/universal-translator/tree/master/examples/file-formats) +- [Formats](https://github.com/go-playground/universal-translator/tree/master/_examples/file-formats) ##### Basic Makeup -NOTE: not all fields are needed for all translation types, see [examples](https://github.com/go-playground/universal-translator/tree/master/examples/file-formats) +NOTE: not all fields are needed for all translation types, see [examples](https://github.com/go-playground/universal-translator/tree/master/_examples/file-formats) ```json { "locale": "en", diff --git a/examples/basic/main.go b/_examples/basic/main.go similarity index 100% rename from examples/basic/main.go rename to _examples/basic/main.go diff --git a/examples/file-formats/cardinal.json b/_examples/file-formats/cardinal.json similarity index 100% rename from examples/file-formats/cardinal.json rename to _examples/file-formats/cardinal.json diff --git a/examples/file-formats/ordinal.json b/_examples/file-formats/ordinal.json similarity index 100% rename from examples/file-formats/ordinal.json rename to _examples/file-formats/ordinal.json diff --git a/examples/file-formats/plain-substitution.json b/_examples/file-formats/plain-substitution.json similarity index 100% rename from examples/file-formats/plain-substitution.json rename to _examples/file-formats/plain-substitution.json diff --git a/examples/file-formats/range.json b/_examples/file-formats/range.json similarity index 100% rename from examples/file-formats/range.json rename to _examples/file-formats/range.json diff --git a/examples/full-no-files/home.tmpl b/_examples/full-no-files/home.tmpl similarity index 100% rename from examples/full-no-files/home.tmpl rename to _examples/full-no-files/home.tmpl diff --git a/examples/full-no-files/main.go b/_examples/full-no-files/main.go similarity index 98% rename from examples/full-no-files/main.go rename to _examples/full-no-files/main.go index 392d36b..274750a 100644 --- a/examples/full-no-files/main.go +++ b/_examples/full-no-files/main.go @@ -11,8 +11,8 @@ import ( "github.com/go-playground/locales/currency" "github.com/go-playground/locales/en" "github.com/go-playground/locales/fr" - "github.com/go-playground/pure" - "github.com/go-playground/pure/examples/middleware/logging-recovery" + "github.com/go-playground/pure/v5" + "github.com/go-playground/pure/v5/_examples/middleware/logging-recovery" "github.com/go-playground/universal-translator" ) diff --git a/examples/full-with-files/home.tmpl b/_examples/full-with-files/home.tmpl similarity index 100% rename from examples/full-with-files/home.tmpl rename to _examples/full-with-files/home.tmpl diff --git a/examples/full-with-files/main.go b/_examples/full-with-files/main.go similarity index 98% rename from examples/full-with-files/main.go rename to _examples/full-with-files/main.go index 97553ee..a90cab8 100644 --- a/examples/full-with-files/main.go +++ b/_examples/full-with-files/main.go @@ -11,8 +11,8 @@ import ( "github.com/go-playground/locales/currency" "github.com/go-playground/locales/en" "github.com/go-playground/locales/fr" - "github.com/go-playground/pure" - "github.com/go-playground/pure/examples/middleware/logging-recovery" + "github.com/go-playground/pure/v5" + "github.com/go-playground/pure/v5/_examples/middleware/logging-recovery" "github.com/go-playground/universal-translator" ) diff --git a/examples/full-with-files/translations/en/home.json b/_examples/full-with-files/translations/en/home.json similarity index 100% rename from examples/full-with-files/translations/en/home.json rename to _examples/full-with-files/translations/en/home.json diff --git a/examples/full-with-files/translations/fr/home.json b/_examples/full-with-files/translations/fr/home.json similarity index 100% rename from examples/full-with-files/translations/fr/home.json rename to _examples/full-with-files/translations/fr/home.json diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..8079590 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/go-playground/universal-translator + +go 1.13 + +require github.com/go-playground/locales v0.13.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..cbbf324 --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/import_export_test.go b/import_export_test.go index e6a8505..5dbae2d 100644 --- a/import_export_test.go +++ b/import_export_test.go @@ -747,7 +747,7 @@ func TestBadImport(t *testing.T) { } f.Close() - expected = "read testdata/bad-translation6.json: bad file descriptor" + expected = "read testdata/bad-translation6.json: file already closed" err = uni.ImportByReader(FormatJSON, f) if err == nil || err.Error() != expected { t.Fatalf("Expected '%s' Got '%s'", expected, err)