+ /*
+ This is a hack so that we can interpolate JavaScript variables in
+ translation strings from Ruby, doing the string replacement
+ client-side instead of on the server.
+ */
+ function i18n_js(string, keys) {
+ for (var key in keys) {
+ var re_key = '\{\{' + key + '\}\}';
+ var re = new RegExp(re_key, "g");
+
+ string = string.replace(re, keys[key]);
+ }
+
+ return string;
+ }
+