import Vue from 'vue'
import App from './App'
import I18n from 'vue-i18n'
import Cookie from 'vue-cookie'
import { sync } from 'vuex-router-sync'
import router from './router'
import store from './store'
import en from 'locales/en'
import ja from 'locales/ja'

// progressive web app
if (process.env.NODE_ENV === 'production') {
  require('./pwa')
}

sync(store, router)

const locales = {
  en: en,
  ja: ja
}

Vue.use(Cookie)
Vue.use(I18n)

// Check if language cookie has been set
// If so, use it
// Else use English
Vue.config.lang = Vue.cookie.get('lang') ? Vue.cookie.get('lang') : 'en'

// Set fallback used for untranslated strings
Vue.config.fallbackLang = 'en'

Object.keys(locales).forEach(lang => {
  Vue.locale(lang, locales[lang])
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

@@ -258,31 +258,8 @@
 a'%0A%0A
-// progressive web app%0A
 if (
@@ -305,24 +305,190 @@
 %7B%0A  
-require('./pwa')
+// Enable Progressive Web App%0A  require('./pwa')%0A%0A  // Redirect HTTP to HTTPS%0A  if (location.protocol === 'http:') %7B%0A    location.href = location.href.replace(/%5Ehttp:/, 'https:')%0A  %7D
 %0A%7D%0A%0A

Redirect HTTP traffic to HTTPS