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

additional method #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

myadream
Copy link

@myadream myadream commented Jun 12, 2024

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"),
	},
    }))
  })

@appleboy
Copy link
Member

@myadream I will take it.

@myadream myadream changed the title additional HasLang method additional method Jun 15, 2024
@myadream
Copy link
Author

myadream commented Jun 15, 2024

@appleboy hi, This pull request introduces several new methods and adds support for additional message types. #55 (comment)

And I've noticed that there is an execution environment error with the GitHub Actions

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.

2 participants