예제 #1
0
func en() {
	p := simple.New().AddLanguage("en", "English", map[string]string{
		TimeFormatRoot + ":" + DateFormat + ":" + OptionDefault: "Jan 02, 2006",
	})

	ginta.Register(p)
	internal.Activate("en")
}
예제 #2
0
func de() {
	p := simple.New().AddLanguage("de", "Deutsch", map[string]string{
		TimeFormatRoot + ":" + DateTimeFormat + ":" + OptionLong: "Monday, 02. January 2006, um 15:04",
		SubstitutionsResourceBundle + ":Wednesday":               "Mittwoch",
		SubstitutionsResourceBundle + ":May":                     "Mai",
	})

	ginta.Register(p)
	internal.Activate("de")
}
예제 #3
0
파일: i18n.go 프로젝트: beatgammit/ginta
/*
	Returns a resource by simple name matching
*/
func (l Locale) GetResource(key string) (string, error) {
	locale := string(l)
	internal.Activate(locale)
	return internal.Request(locale, key, false)
}
예제 #4
0
파일: i18n.go 프로젝트: beatgammit/ginta
/*
	Resolves a resource by its hierarchical key.
*/
func (l Locale) ResolveResource(k types.HierarchicalKey) (string, error) {
	locale := string(l)
	internal.Activate(locale)
	return internal.Request(locale, string(k), true)
}
예제 #5
0
파일: i18n.go 프로젝트: beatgammit/ginta
/*
	Returns the combination of this resource bundle and all its parent bundles. The resources
	defined in a child are not overwritten by its parent.
*/
func (l Locale) ResolveResourceBundle(prefix string) map[string]string {
	locale := string(l)
	internal.Activate(locale)
	return internal.RequestBundle(locale, prefix, true)
}