Guest User

Untitled

a guest
Dec 11th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. steal("en.json", "messageformat.js", function( translation ) {
  2.  
  3. var mf = new MessageFormat("en"),
  4. cache = {};
  5.  
  6. // Add EJS helper
  7. can.extend( can.EJS.Helpers.prototype, {
  8.  
  9. message : function( key, data ) {
  10. if ( ! cache[ key ] ) {
  11. cache[ key ] = mf.compile( translation[ key ] || "ERROR: <" + key + "> NOT DEFINED" );
  12. }
  13.  
  14. return cache[ key ].call( this, data || {} );
  15. }
  16.  
  17. });
  18.  
  19. });
Add Comment
Please, Sign In to add comment