public static void writeWithLocale(File emlFile,Resource resource,Locale locale){
  Locale currentLocale=Locale.getDefault();
  try {
synchronized (currentLocale) {
      Locale.setDefault(locale);
      EmlWriter.writeEmlFile(emlFile,resource.getEml());
      Locale.setDefault(currentLocale);
    }
  }
 catch (  IOException e) {
    LOG.error(e);
    throw new InvalidConfigException(TYPE.CONFIG_WRITE,"IO exception when writing eml for " + resource);
  }
catch (  TemplateException e) {
    LOG.error("EML template exception",e);
    throw new InvalidConfigException(TYPE.EML,"EML template exception when writing eml for " + resource + ": "+ e.getMessage());
  }
 finally {
    Locale.setDefault(currentLocale);
  }
}

public static void writeWithLocale ( File emlFile , Resource resource , Locale locale ) { Locale currentLocale = Locale . getDefault ( ) ; try { synchronized ( currentLocale ) { Locale . setDefault ( locale ) ; EmlWriter . writeEmlFile ( emlFile , resource . getEml ( ) ) ; Locale . setDefault ( currentLocale ) ; } } catch ( IOException e ) { LOG . error ( e ) ; throw new InvalidConfigException ( TYPE . CONFIG_WRITE , "IO exception when writing eml for " + resource ) ; } catch ( TemplateException e ) { LOG . error ( "EML template exception" , e ) ; throw new InvalidConfigException ( TYPE . EML , "EML template exception when writing eml for " + resource + ": " + e . getMessage ( ) ) ; } finally { Locale . setDefault ( currentLocale ) ; } }
writes the eml file using a specific locale to interpret correctly : decimal separators , commas and currency formats .
