tr
tr copied to clipboard
Refactor
trafficstars
Hi, thanks for this! Saved me a lot of work. Did a little refactor to it to fix some issues I found while using it.
- Made the Init function return the Engine so it can be passed around into other functions, instead of being initialized all the time and removed the Tr and Lang functions in tr.go as they were no longer neccessary.
- Handle situation where a localeName doesnt exist
- Updated readme to reflect changes
Hey,
Thanks of all, thank you for your contribution. I really liked your changes, but I'd rather keep both Tr and Lang methods. In Go it's generally accepted to have an idea of "default" something, see. net/http's DefaultClient. I believe it's no harm to have an extra global thing running for the sake of it. It certainly does work for all apps I use tr for.