Snapshot of kataras/i18n: 117★, Go, Backend. :new: High-performant and powerful localization and internationalization support for Go
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
The language code MUST be right before the file extension.
The Default I18n instance will try to load locale files from ./locales directory.
Use the Tr package-level function to translate a text based on the given language code. Use the GetMessage function to translate a text based on the incoming http.Request. Use the Router function to wrap an http.Handler (i.e an http.ServeMux) to set the language based on path prefix such as /zh-CN/some-path and subdomains such as zh.domain.comwithout the requirement of different routes per language.
Let's take a look at the simplest usage of this package.
Using template variables & functions as values in your locale value entry via LoaderConfig.
We are going to use a 3rd-party package for plural and singular words. Note that this is only for english dictionary, but you can use the "current"Locale and make a map with dictionaries to pluralize words based on the given language.
Before we get started, install the necessary packages:
$ go get github.com/kataras/i18n@master
$ go get github.com/gertd/go-pluralize@master
Let's create two simple translation files for our example. The ./locales/en-US/welcome.yml and ./locales/el-GR/welcome.yml respectfully:
Dog: "dog"
HiDogs: Hi {{plural (tr "Dog") .count }}
The tr template function is a builtin function registered per locale. It returns the key's translated value. E.g. on english file the tr "Dog" returns the Dog:'s value: "dog" and on greek file it returns "σκυλί". This function helps importing a key to another key to complete a sentence.
Now, create a main.go file and store the following contents:
For a more detailed technical documentation you can head over to our godocs. And for executable code you can always visit the _examples repository's subdirectory.
License
kataras/i18n is free and open-source software licensed under the MIT License.
How does kataras/i18n compare to other Backend projects?
kataras/i18n is tracked by TopGit in the Backend category, with 117 GitHub stars and written in Go. Browse the Backend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does kataras/i18n have?
kataras/i18n has 117 GitHub stars — refresh the page for the live number, or check github.com/kataras/i18n. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is kataras/i18n open source?
Yes — kataras/i18n ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/kataras/i18n.
What else is in the Backend space?
kataras/i18n is tracked by TopGit under the Backend category, alongside 10 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is kataras/i18n?
kataras/i18n (kataras/i18n) is a Go project on GitHub. From the project's own README: :new: High-performant and powerful localization and internationalization support for Go
Where can I see kataras/i18n in action?
The project maintains a homepage at https://en.wikipedia.org/wiki/Website_localization. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about kataras/i18n?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/kataras/i18n is the definitive source.
Read full README in the tab above.
Still deciding about i18n?
One click hands the question to an AI along with this page — see what it says about i18n.