import en from './assets/locales/en/messages.json';
import fr from './assets/locales/fr/messages.json';
const MESSAGES_ALL = {
  'en': en,
  'fr': fr,
};
export class DocsLocalization {
  constructor() {
    this.getLocale = () => this.locale;
    this.getString = (id) => this.bundle[id] || en[id];
    const prefix = /^\/docs\/([a-z]{2}\b)?/;
    const regexRes = prefix.exec(window.location.pathname);
    const language = regexRes ? regexRes[1] : null;
    this.locale = language && MESSAGES_ALL.hasOwnProperty(language) ? language : 'en';
    this.bundle = MESSAGES_ALL[this.locale];
  }
}
export const l10n = new DocsLocalization();
