Quick fix for i18n
Just use the english locale for now. Load locale data from the filesystem in the main process and pass it to the renderer preload script via ipc. Note that we need the locale data to be available by the time view scripts are loaded. // FREEBIEpull/749/head
							parent
							
								
									88893079d2
								
							
						
					
					
						commit
						63657db3be
					
				@ -0,0 +1,22 @@
 | 
			
		||||
/*
 | 
			
		||||
 * vim: ts=4:sw=4:expandtab
 | 
			
		||||
 */
 | 
			
		||||
;(function() {
 | 
			
		||||
    'use strict';
 | 
			
		||||
    var json = window.env.locale_json;
 | 
			
		||||
    window.i18n = function (message, substitutions) {
 | 
			
		||||
      var s = json[message] ? json[message].message : message;
 | 
			
		||||
      if (substitutions instanceof Array) {
 | 
			
		||||
        substitutions.forEach(function(sub) {
 | 
			
		||||
          s = s.replace(/\$.+?\$/, sub);
 | 
			
		||||
        });
 | 
			
		||||
      } else if (substitutions) {
 | 
			
		||||
        s = s.replace(/\$.+?\$/, substitutions);
 | 
			
		||||
      }
 | 
			
		||||
      return s;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    i18n.getLocale = function() {
 | 
			
		||||
      return window.env.locale;
 | 
			
		||||
    };
 | 
			
		||||
})();
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue