Support lang extanding for internal translations

This commit is contained in:
Denis Arh
2021-08-25 22:47:29 +02:00
parent 3a9348500b
commit c27b0281ca
+13
View File
@@ -132,6 +132,19 @@ func (svc *service) Reload() error {
svc.set[lang.Tag] = lang
}
// Do another pass and link all extended languages
for _, lang := range svc.set {
if lang.Extends.IsRoot() {
continue
}
if svc.set[lang.Extends] == nil {
return fmt.Errorf("could not extend langage %q from an unknown language %q", lang.Tag, lang.Extends)
}
lang.extends = svc.set[lang.Extends]
}
return nil
}