|
@@ -23,7 +23,7 @@ func New(fallback locales.Translator, supportedLocales ...locales.Translator) *U
|
|
|
for _, v := range supportedLocales {
|
|
for _, v := range supportedLocales {
|
|
|
|
|
|
|
|
trans := newTranslator(v)
|
|
trans := newTranslator(v)
|
|
|
- t.translators[strings.ToLower(trans.Locale())] = newTranslator(trans)
|
|
|
|
|
|
|
+ t.translators[strings.ToLower(trans.Locale())] = trans
|
|
|
|
|
|
|
|
if fallback.Locale() == v.Locale() {
|
|
if fallback.Locale() == v.Locale() {
|
|
|
t.fallback = trans
|
|
t.fallback = trans
|
|
@@ -65,6 +65,11 @@ func (t *UniversalTranslator) GetTranslator(locale string) Translator {
|
|
|
return t.fallback
|
|
return t.fallback
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// GetFallback returns the fallback locale
|
|
|
|
|
+func (t *UniversalTranslator) GetFallback() Translator {
|
|
|
|
|
+ return t.fallback
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// AddTranslator adds the supplied translator, if it already exists the override param
|
|
// AddTranslator adds the supplied translator, if it already exists the override param
|
|
|
// will be checked and if false an error will be returned, otherwise the translator will be
|
|
// will be checked and if false an error will be returned, otherwise the translator will be
|
|
|
// overridden; if the fallback matches the supplied translator it will be overridden as well
|
|
// overridden; if the fallback matches the supplied translator it will be overridden as well
|