Closed heralight closed 1 year ago
It is better to make the caching optional (opt-in) like adding an optional named parameter for setLocale "cache" or something like that.
The reason is that this library has multi-package support so the locale can be changed everywhere.
Ok, noted. I close the mr.
Thank you!
Hi!
Thank you for this great library!
I've encountered a performance problem due to the fact that 'translate_var' is recalculated on each call, the locale is extracted each time.
Testing,
Time taken: 2628 ms vs:
Time taken: 1595 ms
For my part, I use the "translation_class_visibility: public" flag to create an intermediate cache, but doing so or proposing it at library level would be a plus.
So, in this merge request, I'm adding a private cache variable. Its reset on setLocale() calls is missing, hence the partial nature of this merge request, as I don't know what would be the best approach.
I look forward to hearing from you soon and thank you,
Alexandre