Scuffling with multi-language web site for some time. There are a lot of methods to do that as I perceive. I discovered a technique utilizing GitHub – leonelquinteros/gotext: Go (Golang) GNU gettext utilities package deal. Which appears to be easier than golang.org/x/textual content
IMHO.
I must be glad if anyone may make a evaluation of my code and inform me if I’m heading in the right direction or not.
Stay preview
1 Like
Hey,
General seems to be good to me, a couple of adjustments, I’d make is eradicating init() and possibly utilizing GitHub – nicksnyder/go-i18n: Translate your Go program into a number of languages. however it’s extremely private, I solely used hugo(it was the best possibility) for i18n previously
one facet I can see which can enhance, you should utilize go:embed
to your public static property/templates with embed.FS in order that your closing binary could be standalone with locale/
recordsdata
you additionally gained’t want a mutex if you’re solely studying from the map solely, I wouldn’t do in-memory unsafe map and skim/write in http handlers as a result of it could develop ultimately, in all probability what you want is one thing like a thread-safe LRU(least just lately used cache in case you proceed(you will have eviction at some stage in the map or the cache) with this library and method GitHub – hashicorp/golang-lru: Golang LRU cache)
1 Like