Là một dự án backend, kataras/i18n đã đạt 118 sao trên GitHub, ngôn ngữ Go. :new: High-performant and powerful localization and internationalization support for Go
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
kataras/i18n thuộc nhóm Backend trên TopGit, cùng 10 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về kataras/i18n ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/kataras/i18n là nguồn chính thức.
kataras/i18n có bao nhiêu sao?
kataras/i18n có 118 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/kataras/i18n. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
kataras/i18n có phải mã nguồn mở không?
Có — kataras/i18n phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/kataras/i18n.
kataras/i18n có trang demo không?
Dự án có trang chủ ở https://en.wikipedia.org/wiki/Website_localization. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
kataras/i18n là gì?
kataras/i18n (kataras/i18n) là dự án Go trên GitHub. Theo mô tả gốc: :new: High-performant and powerful localization and internationalization support for Go
kataras/i18n so với các dự án Backend khác thế nào?
kataras/i18n được TopGit xếp vào nhóm Backend, với 118 sao GitHub và viết bằng Go. Xem trang chủ đề Backend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về i18n?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về i18n.