Prevent dev mode from overwriting resource translations
This commit is contained in:
parent
10d4152ad6
commit
e6a3232ea1
@ -134,7 +134,12 @@ func (svc *service) ReloadStatic() (err error) {
|
||||
zap.Strings("tags", tagsToStrings(svc.tags)),
|
||||
)
|
||||
|
||||
svc.set = make(map[language.Tag]*Language)
|
||||
// In case where this is already initialized, we need to make sure to
|
||||
// preserve any resource translations.
|
||||
// The preservation is handled below, before we update svc.set.
|
||||
if svc.set == nil {
|
||||
svc.set = make(map[language.Tag]*Language)
|
||||
}
|
||||
|
||||
// load embedded locales from the corteza-locale package
|
||||
if ll, err = loadConfigs(locale.Languages()); err != nil {
|
||||
@ -206,6 +211,13 @@ func (svc *service) ReloadStatic() (err error) {
|
||||
)
|
||||
}
|
||||
|
||||
// Preserve current resource translations.
|
||||
// Resource translations are updated when they change so these are
|
||||
// already up to date.
|
||||
if existing, ok := svc.set[lang.Tag]; ok {
|
||||
lang.resources = existing.resources
|
||||
}
|
||||
|
||||
svc.set[lang.Tag] = lang
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user