i18next / ng-i18next

translation for AngularJS using i18next
https://github.com/i18next/ng-i18next
MIT License
161 stars 54 forks source link

Provider($i18nextTanslate): do shallow instead of deep copy #94

Closed holgerde closed 9 years ago

holgerde commented 9 years ago

We discovered a performance problem in our application and found $i18nextTanslate to be the culprit. It makes a deep copy of the global options for every translation. In our application, the global options contain all translations (which is one of the supported ways to provide the translations). So every time the function is called, all translations get copied.

Since the copy is only made to overwrite the ns field, a shallow copy is sufficient and much faster.