leonelquinteros / gotext

Go (Golang) GNU gettext utilities package
Other
434 stars 58 forks source link

documentation on usage with templates? #78

Closed unDocUMeantIt closed 1 year ago

unDocUMeantIt commented 1 year ago

i'm trying to write a web service with language support. that is, the text to translate is located in HTML templates.

the documentation explains how to fetch string translations in templates by using a locale object. however, i couldn't find documentation yet on how to get the translatable strings from my templates into a .pot file in the first place. i tried xgotext but it doesn't seem to search the templates. are there solutions for this available yet?

leonelquinteros commented 1 year ago

Hi, no, there is no tool that I know to extract translation strings from your templates.

unDocUMeantIt commented 1 year ago

thanks for the quick reply!

ok, so i wrote a small tool myself. it's not well tested yet, but perhaps it's useful for others anyway.

youthlin commented 1 year ago

@unDocUMeantIt wish this helps you: https://github.com/youthlin/t/tree/main/cmd/xtemplate