{"id":25546961,"url":"https://github.com/fishjar/gin-i18n","last_synced_at":"2026-05-01T00:31:45.501Z","repository":{"id":56854190,"uuid":"523606176","full_name":"fishjar/gin-i18n","owner":"fishjar","description":"Simple gin i18n middleware (简单的 gin 多语言支持中间件)","archived":false,"fork":false,"pushed_at":"2023-03-23T07:54:01.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-20T09:18:56.577Z","etag":null,"topics":["gin","gin-i18n","i18n"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fishjar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-11T06:11:28.000Z","updated_at":"2024-10-13T03:16:06.000Z","dependencies_parsed_at":"2024-11-14T14:32:41.586Z","dependency_job_id":"ab77e810-9319-4427-871f-f44c0ac60b48","html_url":"https://github.com/fishjar/gin-i18n","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fishjar/gin-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjar%2Fgin-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjar%2Fgin-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjar%2Fgin-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjar%2Fgin-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fishjar","download_url":"https://codeload.github.com/fishjar/gin-i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjar%2Fgin-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32481553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin","gin-i18n","i18n"],"created_at":"2025-02-20T09:18:59.276Z","updated_at":"2026-05-01T00:31:45.454Z","avatar_url":"https://github.com/fishjar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple gin i18n middleware\n\nEnglish | [简体中文](README.zh-CN.md)\n\nI found that other people's `gin` i18n middleware too complicated, so I wrote a simple one.\n\n## Example\n\n```go\n// example/main.go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"path\"\n\n\tginI18n \"github.com/fishjar/gin-i18n\"\n\t\"github.com/gin-gonic/gin\"\n)\n\nfunc main() {\n\tgin.SetMode(gin.ReleaseMode)\n\trouter := gin.New()\n\n\t// apply i18n middleware\n\trouter.Use(ginI18n.Localizer(\u0026ginI18n.Options{\n\t\tDefaultLang:  \"zh-CN\",                          // default language\n\t\tSupportLangs: \"zh-CN,en-US\",                    // list of supported languages ​​(must include default language)\n\t\tFilePath:     path.Join(\"example\", \"localize\"), // multilingual file directory\n\t}))\n\n\trouter.GET(\"/\", func(c *gin.Context) {\n\t\tc.String(http.StatusOK, ginI18n.Msg(c, \"welcome\"))\n\t})\n\n\trouter.GET(\"/:name\", func(c *gin.Context) {\n\t\tc.String(http.StatusOK, ginI18n.Msg(c, \"hello_world\", c.Param(\"name\")))\n\t})\n\n\tif err := router.Run(\":8080\"); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n```yaml\n# example/localize/zh-CN.yml\nwelcome: 欢迎！\nhello_world: 你好 %s!\n```\n\n```yaml\n# example/localize/en-US.yml\nwelcome: welcome!\nhello_world: hello %s!\n```\n\n```sh\n# review\ngo run example/main.go\n\ncurl http://127.0.0.1:8080/ -H 'accept-language: zh-CN'             # 欢迎！\ncurl http://127.0.0.1:8080/ -H 'accept-language: en-US'             # welcome!\n\ncurl http://127.0.0.1:8080/ -H 'accept-language: zh-CN,en-US;q=0.9' # 欢迎！\ncurl http://127.0.0.1:8080/ -H 'accept-language: zh-CN;q=0.9,en-US' # welcome!\n\ncurl http://127.0.0.1:8080/ -H 'accept-language: zh'                # 欢迎！\ncurl http://127.0.0.1:8080/ -H 'accept-language: en'                # welcome!\n\ncurl http://127.0.0.1:8080/gabe -H 'accept-language: zh-CN'         # 你好 gabe!\ncurl http://127.0.0.1:8080/gabe -H 'accept-language: en-US'         # hello gabe!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishjar%2Fgin-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffishjar%2Fgin-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishjar%2Fgin-i18n/lists"}