spreak icon indicating copy to clipboard operation
spreak copied to clipboard

Load locales from both embed fs and file system

Open iredmail opened this issue 10 months ago • 0 comments

Dear developers,

If we specify both spreak.WithDomainFs() and spreak.WithDomainPath() with same domain while calling spreak.NewBundle(), spreak reports error: spreak: loader for domain <domain> already set.

	bundle, err = spreak.NewBundle(
		spreak.WithDomainFs("mydomain", ...),
		spreak.WithDomainPath("mydomain", ...),
                ...
	)

The use case is, we embed locale files (e.g. de_DE.json) in Go binary, but users want to download a copy and improve it, hence our Go code supports loading extra locale files from path on file system (e.g. /opt/app/locales/). In this case we wish spreak.NewBundle() to load from both places (embed + disk), also last loaded one overrides existing one.

The ideal behaviour is overriding locales in same domain.

iredmail avatar Apr 02 '25 01:04 iredmail