martinandert / counterpart

A translation and localization library for Node.js and the browser.
MIT License
242 stars 25 forks source link

Bad iteration if language fallback fails #49

Closed HarukaMa closed 6 years ago

HarukaMa commented 6 years ago

https://github.com/martinandert/counterpart/blob/e1e4204623997f6135694b917d4d92837f7e2f94/index.js#L223-L224

I'm encountering this using bitshares-ui which uses this library to handle translations.

This library uses for...in to iterate over fallback language array, but if the fallback fail the code will continue to iterate over other objects in the array, like in the picture below. Using other for methods would avoid the problem.

0029-12-28 3 57 49


You may want to avoid for...of though as it would possibly break some ES6-incompatible configurations... C-style for works.