Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature additional methods #63

Merged
merged 18 commits into from
Nov 14, 2024
Merged

Conversation

myadream
Copy link
Contributor

method use

  router.GET("/exist/:lang", func(ctx *gin.Context) {
    ctx.String(http.StatusOK, "%v", ginI18n.HasLang(ctx, ctx.Param("lang")))
  })
  
  // get the default and current language
  router.GET("/lang/default", func(context *gin.Context) {
    context.String(http.StatusOK, "%s", GetDefaultLanguage(context).String())
  })

  // get the current language
  router.GET("/lang/current", func(context *gin.Context) {
    context.String(http.StatusOK, "%s", GetCurrentLanguage(context).String())
  })
  
 router.GET("/messageType/:name", func(context *gin.Context) {
    context.String(http.StatusOK, MustGetMessage(context, &i18n.LocalizeConfig{
	DefaultMessage: &i18n.Message{
		ID: "welcomeWithName",
	},
	TemplateData: map[string]string{
		"name": context.Param("name"),
	},
    }))
  })

myadream and others added 18 commits June 12, 2024 18:27
- Rename "Checkout" to "Checkout repository"
- Rename "Set up Go" to "Setup go"
- Change Go version specification to use `go-version-file: go.mod` and add `check-latest: true`
- Update goreleaser action from v5 to v6

Signed-off-by: Bo-Yi Wu <[email protected]>
- Update `github.com/gin-gonic/gin` to v1.10.0
- Update `golang.org/x/text` to v0.16.0
- Update `github.com/bytedance/sonic` to v1.11.8
- Update `github.com/gabriel-vasile/mimetype` to v1.4.4
- Update `github.com/go-playground/validator/v10` to v10.22.0
- Update `github.com/goccy/go-json` to v0.10.3
- Update `github.com/klauspost/cpuid/v2` to v2.2.8
- Update `golang.org/x/arch` to v0.8.0
- Update `golang.org/x/crypto` to v0.24.0
- Update `golang.org/x/net` to v0.26.0
- Update `golang.org/x/sys` to v0.21.0
- Update `google.golang.org/protobuf` to v1.34.2

Signed-off-by: Bo-Yi Wu <[email protected]>
- Update Go version from 1.18 to 1.20
- Upgrade golang.org/x/text from v0.16.0 to v0.17.0
- Upgrade github.com/bytedance/sonic from v1.11.8 to v1.12.1 and its loader from v0.1.1 to v0.2.0
- Upgrade github.com/gabriel-vasile/mimetype from v1.4.4 to v1.4.5
- Upgrade golang.org/x/arch from v0.8.0 to v0.9.0
- Upgrade golang.org/x/net from v0.26.0 to v0.28.0
- Upgrade golang.org/x/sys from v0.21.0 to v0.24.0

Signed-off-by: appleboy <[email protected]>
- Remove macOS from the OS matrix in the GitHub Actions workflow
- Update the Go versions to only include 1.20, 1.21, and 1.22

Signed-off-by: appleboy <[email protected]>
- The CodeQL analysis workflow file has been deleted.

Signed-off-by: appleboy <[email protected]>
- Remove build constraints for Go version 1.16

Signed-off-by: appleboy <[email protected]>
- Update Go versions in GitHub Actions workflow to include 1.23 and remove 1.20

Signed-off-by: appleboy <[email protected]>
- Update Go version from 1.20 to 1.21.0
- Upgrade `golang.org/x/text` from v0.17.0 to v0.18.0
- Upgrade `github.com/bytedance/sonic` from v1.12.1 to v1.12.3
- Upgrade `github.com/go-playground/validator/v10` from v10.22.0 to v10.22.1
- Upgrade `github.com/pelletier/go-toml/v2` from v2.2.2 to v2.2.3
- Upgrade `golang.org/x/arch` from v0.9.0 to v0.10.0
- Upgrade `golang.org/x/crypto` from v0.26.0 to v0.27.0
- Upgrade `golang.org/x/net` from v0.28.0 to v0.29.0
- Upgrade `golang.org/x/sys` from v0.24.0 to v0.25.0

Signed-off-by: appleboy <[email protected]>
- Update `github.com/nicksnyder/go-i18n/v2` to version `2.4.1`
- Update `golang.org/x/text` to version `0.20.0`
- Update `github.com/bytedance/sonic` to version `1.12.4` (indirect)
- Update `github.com/bytedance/sonic/loader` to version `0.2.1` (indirect)
- Update `github.com/gabriel-vasile/mimetype` to version `1.4.6` (indirect)
- Update `github.com/klauspost/cpuid/v2` to version `2.2.9` (indirect)
- Update `golang.org/x/arch` to version `0.12.0` (indirect)
- Update `golang.org/x/crypto` to version `0.29.0` (indirect)
- Update `golang.org/x/net` to version `0.31.0` (indirect)
- Update `golang.org/x/sys` to version `0.27.0` (indirect)
- Update `google.golang.org/protobuf` to version `1.35.1` (indirect)

Signed-off-by: appleboy <[email protected]>
- Add detailed comments for the `ginI18nImpl` struct and its methods
- Add detailed comments for the `GinI18n` interface and its methods
- Add detailed comments for the `GetLngHandler` and `Option` types

Signed-off-by: appleboy <[email protected]>
add extend methods
@myadream
Copy link
Contributor Author

@appleboy done

@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 60.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 68.67%. Comparing base (24c0a92) to head (95b1698).
Report is 21 commits behind head on master.

Files with missing lines Patch % Lines
ginI18n.go 47.36% 10 Missing ⚠️
i18n.go 81.81% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #63      +/-   ##
==========================================
- Coverage   70.58%   68.67%   -1.92%     
==========================================
  Files           5        5              
  Lines         136      166      +30     
==========================================
+ Hits           96      114      +18     
- Misses         32       44      +12     
  Partials        8        8              
Flag Coverage Δ
go- ?
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.22 68.67% <60.00%> (-1.92%) ⬇️
macos-latest ?
ubuntu-latest 68.67% <60.00%> (-1.92%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@appleboy appleboy merged commit ff4e841 into gin-contrib:master Nov 14, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants