brandingbrand/hbs — pull request #3 by NickMele (2014-11-10 22:55:07+00:00)
Title: BSWAPJS-206 - Per request helpers

https://jira.brandingbrand.com/browse/BSWAPJS-206

This was an issue that was discovered on Levi's international site, and was patched on a separate branch. We are now seeing these same issues on BrownsShoes, which is using the latest version of bb-mirage that does not have this fix.

The issue is that current helpers are application configuration based which can cause really bad race conditions with localization helpers. This allows for helpers to be created per request, which gives access to the current locale for a request. I believe that this fix has been proven on Levi's site and should be good to be merged into master so that our latest versions of bb-mirage can pick them up.

The new frontend is not affected by this because it, by default, uses i18n on a per request basis.

## Testing
1. you can test this by pulling down the branch of bb-mirage: https://github.com/brandingbrand/node-bb-mirage/tree/levi-eu, which references this branch.
2. there should be no affect on current helpers in mirage, but it will allow you to write middleware that creates per request helpers like: https://github.com/brandingbrand/levi-eu.m/blob/bab6ed09313da30fe6510552f58bf6112ecede0e/lib/middleware.js#L88-L105