3 ms·
I must admit that I haven't looked into the speed side of it too much! I suspect it's not too bad as the YAML file is loaded once on initialisation into a hash,
by robotmay 13y ago
I must admit that I haven't looked into the speed side of it too much! I suspect it's not too bad as the YAML file is loaded once on initialisation into a hash, which the t() function then retrieves the values from. I'm not sure if that differs when using a database backend.
One benefit of using Slim here is that it's a bit faster than ERB/HAML (as you can see in my token biased benchmarks: https://speakerdeck.com/robotmay/a-simple-introduction-to-effective-caching-in-ruby-on-rails?slide=22 https://speakerdeck.com/robotmay/a-simple-introduction-to-ef...) so it probably negates any extra time that might be added by using locales.
There's two main reasons I use locales so heavily:
1. I like my views to be small and largely free of logic
2. I'd like to translate the site into other languages, and using locales from the start makes it much simpler!