i18n icon indicating copy to clipboard operation
i18n copied to clipboard

additional method

Open myadream opened this issue 8 months ago • 2 comments

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 avatar Jun 12 '24 10:06 myadream