title: Use the same service instantiation from main.ts and in app.module (singleton everywhere)
body: <p>I have a service named "LocaleService" provided in 'root' which contains all my locale logic.</p>
  
  <p>This service init the localization of the app and provide some functions about locales.</p>
  
  <p>I have to initialize this service in the main.ts to make the angular locale works</p>
  
  <p>Here my initialization :</p>
  
  <pre><code>var injector = ReflectiveInjector.resolveAndCreate([LocaleService]);
  var localeService : LocaleService = injector.get(LocaleService)
  
  
  platformBrowserDynamic().bootstrapModule(AppModule, {
    providers: [
      { provide: TRANSLATIONS, useValue: localeService.translations },
      { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' },
      { provide: LOCALE_ID, useValue: localeService.locale },
    ]
  })
    .catch(err =&gt; console.log(err));
  </code></pre>
  
  <p>The problem is that the service get instanced a second time when used in my one of my component like this : </p>
  
  <pre><code>  constructor(private localeService : LocaleService, private userEndpoint: UserEndpoint) { }
  
    ngOnInit() {
  
      alert(this.localeService.locale);
  
      this.user = new User();
  
       this.userEndpoint.getCurrentUser().subscribe(u =&gt;{
         this.user = u;
       })
  
  
    }
  </code></pre>
  
  <p>I wish that my bootstrap providers would carry the same instance everywhere but it doesn't.</p>
  
  <p>Is there a way to carry the same instance i created in main.ts over all my application ?</p>
  
  <p>Here is my service :</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { loadMessages, locale } from 'devextreme/localization';
  import { registerLocaleData } from '@angular/common';
  import localeFRCA from '@angular/common/locales/fr-CA';
  import config from "devextreme/core/config";
  import "devextreme-intl";
  
  declare const require;
  
  @Injectable({providedIn:'root'})
  export class LocaleService {
  
    translations : string;
    locale : string;
  
    constructor(){
  
      //Default currency CAD
      config({defaultCurrency:"CAD"});
      //register angular locale frCA
      registerLocaleData(localeFRCA);
  
      let dxMessageFR = require("devextreme/localization/messages/fr.json");
      loadMessages(dxMessageFR);
  
      this.locale = localStorage.getItem('locale');
      if (!this.locale) {
  
        if (navigator.language.toUpperCase().indexOf("FR") !== -1)
        this.locale = "fr-CA";
        else
        this.locale = "en-CA";
  
        localStorage.setItem('locale', this.locale);
  
      }
      //set devextreme intl language for dev extreme widget;
      locale(this.locale);
  
      this.translations = require(`raw-loader!../../locale/messages.${this.locale}.xlf`);
    }
  
  
  }
  </code></pre>