https://github.com/iris-contrib/i18n
Deprecated (kept for go-get on older versions). Read more at: https://github.com/kataras/iris/wiki/Localization
https://github.com/iris-contrib/i18n
go golang iris iris-cli iris-golang
Last synced: 8 months ago
JSON representation
Deprecated (kept for go-get on older versions). Read more at: https://github.com/kataras/iris/wiki/Localization
- Host: GitHub
- URL: https://github.com/iris-contrib/i18n
- Owner: iris-contrib
- License: apache-2.0
- Created: 2019-12-13T21:50:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-13T21:51:00.000Z (over 6 years ago)
- Last Synced: 2025-08-03T00:02:09.756Z (11 months ago)
- Topics: go, golang, iris, iris-cli, iris-golang
- Language: Go
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
i18n [](https://godoc.org/github.com/iris-contrib/i18n)
[](https://travis-ci.org/iris-contrib/i18n)
====
Package i18n is for app Internationalization and Localization.
This package is a fork of the https://github.com/Unknwon/i18n.
It's heavly used inside the https://github.com/kataras/iris/tree/master/middleware/i18n middleware.
# Changes
This package provides some additional functionality compared to the original one;
PATCH by @j-lenoch at L129:
```go
// IsExistSimilar returns true if the language, or something similar
// exists (e.g. en-US maps to en).
// it returns the found name and whether it was able to match something.
func IsExistSimilar(lang string) (string, bool) {
_, ok := locales.store[lang]
if ok {
return lang, true
}
// remove the internationalization element from the IETF code
code := strings.Split(lang, "-")[0]
for _, lc := range locales.store {
if strings.Contains(lc.lang, code) {
return lc.lang, true
}
}
return "", false
}
A full Patch by @kataras to support multi languages, look the `localeFiles` new type
and the `GetKey, Reload` and improvement of `locales.Add` and more.
```