i18n
i18n copied to clipboard
FallbackLocales doesn't work
Example:
locales/en-US.yml
en-US:
demo:
hi: "hello"
locales/ru-RU.yml
ru-RU:
demo:
hi: "привет"
main.go
package main
import (
"fmt"
"github.com/qor/i18n"
"github.com/qor/i18n/backends/yaml"
)
func main() {
I18n := i18n.New(yaml.New("locales"))
I18n.FallbackLocales = map[string][]string{"ru-RU": []string{"fr-FR", "de-DE", "zh-CN"}}
fmt.Printf("%v\n", I18n.T("en-US", "demo.hi"))
fmt.Printf("%v\n", I18n.T("ru-RU", "demo.hi"))
fmt.Printf("%v\n", I18n.T("zh-CN", "demo.hi"))
}
Output:
go run main.go
hello
привет
hello
According to documentation i should see in the last line translation from locales/ru-RU.yml but I see from default locales/en-US.yml.