I just implemented i18n-js support
in WebSync. This came around after realizing my localization support for
The i18n-js library is super useful and integrates directly with Sprockets and I18n making it as easy as doing:
//= require i18n //= require i18n/translations // Some translation I18n.t('translate-me')
Sprockets::FileNotFound - couldn't find file 'i18n'
I’m pretty sure this is because of the black magic Rails uses to find files. My solution was to force i18n-js to load the middleware and add the static files to the Sprockets files. It’s a huge hack, especially with using “I18n:JS.method(:config).source_location” to find their location.
Here’s the full code:
If anyone knows a better way of doing this, I’d love to know.
As a side note, I wish I had designed WebSync as a RoR app from the start. It would have saved a lot of time hacking Sinatra into being almost identical to Rails. *sighs*