modules/intl/sync/i18n.js
function _init () {
    if (_locale) return
    // TODO: Depject this!
    i18nL.configure({
      directory: appRoot + '/locales',
      defaultLocale: 'en'
    })

    watch(api.settings.obs.get('patchwork.lang'), currentLocale => {
      currentLocale = currentLocale || navigator.language
      var locales = i18nL.getLocales()

      // Try BCP47 codes, otherwise load family language if exist
      if (locales.indexOf(currentLocale) !== -1) {
        i18nL.setLocale(currentLocale)
      } else {
        i18nL.setLocale(getSimilar(locales, currentLocale))
      }

      // Only refresh if the language has already been selected once.
      // This will prevent the update loop
      if (_locale) {
        electron.remote.getCurrentWebContents().reloadIgnoringCache()
      }
    })

    _locale = true
  }
function _init () {
    if (_locale) return
    // TODO: Depject this!
    i18nL.configure({
      directory: appRoot + '/locales',
      defaultLocale: 'en'
    })

    watch(api.settings.obs.get('patchwork.lang'), currentLocale => {
      currentLocale = currentLocale || navigator.language
      var locales = i18nL.getLocales()

      // Try BCP47 codes, otherwise load family language if exist
      if (locales.indexOf(currentLocale) !== -1) {
        i18nL.setLocale(currentLocale)
      } else {
        i18nL.setLocale(getSimilar(locales, currentLocale))
      }

      // Only refresh if the language has already been selected once.
      // This will prevent the update loop
      if (_locale) {
        electron.remote.getCurrentWebContents().reloadIgnoringCache()
      }
    })

    _locale = true
  }
function _init ( ) { if ( _locale ) return // TODO: Depject this! i18nL . configure ( { directory : appRoot + '/locales' , defaultLocale : 'en' } ) watch ( api . settings . obs . get ( 'patchwork.lang' ) , currentLocale => { currentLocale = currentLocale || navigator . language var locales = i18nL . getLocales ( ) // Try BCP47 codes, otherwise load family language if exist if ( locales . indexOf ( currentLocale ) !== - 1 ) { i18nL . setLocale ( currentLocale ) } else { i18nL . setLocale ( getSimilar ( locales , currentLocale ) ) } // Only refresh if the language has already been selected once. // This will prevent the update loop if ( _locale ) { electron . remote . getCurrentWebContents ( ) . reloadIgnoringCache ( ) } } ) _locale = true }
Init an subscribe to settings changes.
Init an subscribe to settings changes .