title: How to change attribute lang html using vue-i18n
body: <p>I want to change atttribute of html element from:</p>
  
  <pre><code>lang='en'
  </code></pre>
  
  <p>to</p>
  
  <pre><code>lang='jp'
  </code></pre>
  
  <p>when i change language using package vue-i18n.</p>
  
  <p>I import plugins vue-i18n in nuxt.config.js and add attribute:</p>
  
  <pre><code> htmlAttrs: {
      lang: this.$i18n.locale,
   },
  </code></pre>
  
  <p>in <code>head</code> object but it throw error: Cannot read property '$i18n' of undefined</p>
  
  <p>This is my vue-i18n plugins:</p>
  
  <pre><code>import Vue from 'vue';
  import VueI18n from 'vue-i18n';
  
  Vue.use(VueI18n);
  
  export default ({ app, store }) =&gt; {
      app.i18n = new VueI18n({
          locale: store.state.i18n.locale,
          fallbackLocale: 'vi',
          messages: {
              en: require('~/locales/en.json'),
              vi: require('~/locales/vi.json'),
              jp: require('~/locales/jp.json'),
          },
      });
  };
  
  </code></pre>
  
  <p>Thanks you for reading!</p>