text: 'use strict';
  
  const merge = require('hexo-util').deepMerge || require('lodash/merge');
  
  hexo.on('generateBefore', function () {
    if (hexo.config.theme_config) {
      hexo.theme.config = merge(hexo.theme.config, hexo.config.theme_config);
    }
  
    const data = hexo.locals.get('data');
  
    if (data.languages) {
      const { language } = hexo.config;
      const { i18n } = hexo.theme;
  
      const mergeLang = lang => {
        if (data.languages[lang])
          i18n.set(lang, merge(i18n.get([lang]), data.languages[lang]));
      };
  
      for (const lang of ['en', 'ja', 'zh-CN', 'zh-HK', 'zh-TW']) {
        mergeLang(lang);
      }
  
    }
  })
  