Default resource translation to key value if missing
This commit is contained in:
@@ -88,6 +88,8 @@ func (r *{{ .Resource }}) DecodeTranslations(tt locale.ResourceTranslationIndex)
|
||||
{{- if not .Custom }}
|
||||
if aux = tt.FindByKey(LocaleKey{{ $Resource }}{{coalesce (export .Name) (export .Path) }}.Path); aux != nil {
|
||||
r.{{ .Field }} = aux.Msg
|
||||
} else {
|
||||
r.{{ .Field }} = LocaleKey{{ $Resource }}{{coalesce (export .Name) (export .Path) }}.Path
|
||||
}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (l *Language) tResource(ns, key string, rr ...string) string {
|
||||
return l.extends.tResource(ns, key, rr...)
|
||||
}
|
||||
|
||||
return ""
|
||||
return key
|
||||
}
|
||||
|
||||
// resourceTranslations returns all resource translations for the specified resource
|
||||
|
||||
Reference in New Issue
Block a user