yaroslav / russian

Russian language support for Ruby and Rails | Поддержка русского языка для Ruby и Rails
MIT License
475 stars 127 forks source link

Sort locale files list alphabetically #56

Open Envek opened 10 years ago

Envek commented 10 years ago

See fnando/i18n-js#239 for explanation, investigation and discussion.

In short: list of files with translations should be always the same (including order). Dir[] may produce list of file paths with different order on different machines.

For example: In case of i18n-js gem it need to produce always equal translation data. If it's not equal and Rails Asset Pipeline is used, it will lead to generating assets with different hashsums on different servers and link to asset in generated page and in the web server will be different, and site will become broken.

There is probably no good solution possible on the side of i18n or i18n-js gems. So every app and every gem should push to I18n.load_path sorted list of filenames.

That's it.