docs: function getI18n(_ref) {
    var translations = _ref.translations;
    var viewExtension = _ref.viewExtension;
    var templatesGlob = _ref.templatesGlob;
  
    return (function () {
      function I18n(roots) {
        _classCallCheck(this, I18n);
  
        this.category = 'views'; // @Jeff is this ok? Really don't understand what the category is for
  
        this.util = new _rootsUtil2.default(roots);
  
        // Gets all the translation files, using `translations` – the user-supplied globbing pattern
        this.langFiles = _globby2.default.sync(_path2.default.join(roots.root, translations));
  
        // Populate the langMap
        this.langFiles.forEach(function (langFile) {
          return langMap.set(langFile, _readYaml2.default.sync(langFile));
        });
      }
  
      _createClass(I18n, [{
        key: 'fs',
        value: function fs() {
          var _this = this;
  
          return {
            extract: true,
  
            // Get all templates using `viewExtension` – the user-supplied extension string
            detect: function detect(file) {
              return _this.util.with_extension(file, [viewExtension]);
            }
          };
        }
      }, {
        key: 'compile_hooks',
        value: function compile_hooks() {
          var _this2 = this;
  
          return { // TODO use async methods and return Promise
  
            // Called for every view template
            write: function write(_ref2) {
              var roots = _ref2.roots;
              var file_options = _ref2.file_options;
              var content = _ref2.content;
              return(
  
                // Start iterating over our languages (as defined by the list of langFiles)
                // Return the translated content and the langFile path
                _this2.langFiles.map(function (langFile) {
                  return [translate(content, langFile), langFile];
                }).map(function (_ref3) {
                  var _ref4 = _slicedToArray(_ref3, 2);
  
                  var content = _ref4[0];
                  var langFile = _ref4[1];
  
                  var p = file_options._path,
                      dir = _path2.default.dirname(p),
                      ext = _path2.default.extname(p),
                      name = _path2.default.basename(p, ext),
                      lang = getLang(langFile);
  
                  // Redirect Roots to write A FILE FOR EACH LANGUAGE, with 'en' as the default
                  return {
                    content: content,
  
                    // Old code, may be useful later:
                    //
                    // path: path.join('.', dir, `${name}.${lang}${ext}`),
                    // extension: `${lang}${ext}`
  
                    path: lang === 'en' ?
                    // Put English in the root output
                    _path2.default.join('.', dir, '' + name + ext) :
                    // And other languages in their subdirectories
                    _path2.default.join('.', lang, dir, '' + name + ext)
  
                  };
                })
              );
            }
          };
        }
  
        // The following is ONLY for roots-records "single view templates"
  
      }, {
        key: 'category_hooks',
        // Old code, may be useful later:
        //
        // path: path.join('.', dir, `${name}${ext}.${lang}`),
        // extension: `${ext}.${lang}`.substr(1)
        value: function category_hooks() {
          var self = this;
  
          // A Set to hold references to view templates that have been processed,
          // so we don't do them multiple times (this was happening, can't remember why)
          if (!this.done) this.done = new Set();
  
          return {
            after: function after(ctx) {
              // If user hasn't supplied `templatesGlob` (i.e. they're not using roots-records)
              // don't do anything
              if (!templatesGlob) return false;else {
                var globs = Array.isArray(templatesGlob) ? templatesGlob : [templatesGlob];
  
                _globby2.default.sync(globs.map(function (glob) {
                  return _path2.default.join(ctx.roots.config.output, glob);
                })).filter(function (file) {
  
                  // Check the Set, don't do it twice
                  if (self.done.has(file)) return false;
                  // Shortcut for add to Set and return true
                  else return self.done.add(file);
                })
  
                // Get the content of each "single view template"
                .map(function (filePath) {
                  return [filePath, _fs2.default.readFileSync(filePath, 'utf8')];
                }).forEach(function (_ref5) {
                  var _ref6 = _slicedToArray(_ref5, 2);
  
                  var filePath = _ref6[0];
                  var content = _ref6[1];
  
                  // As above, for each template, iterate over our languages and translate
                  self.langFiles.forEach(function (langFile) {
  
                    // Translate the file
                    var replacement = translate(content, langFile),
  
                    // `filePath` is the template's path
                    pathArr = filePath.split(_path2.default.sep),
  
                    // `output` is the output folder (usually `public/`)
                    output = pathArr.shift(),
  
                    // Get the path of where the template is in the source folder
                    // (usually `views/...`)
                    origPath = _path2.default.join.apply(_path2.default, _toConsumableArray(pathArr)),
                        lang = getLang(langFile),
  
                    // Get the path of where the translated template should be written
                    newPath = _path2.default.join(output, lang === 'en' ? '' : lang, origPath);
  
                    // Make sure the required destination exists
                    _mkdirp2.default.sync(_path2.default.dirname(newPath));
  
                    // Write the translated view
                    _fs2.default.writeFileSync(newPath, replacement);
                  });
                });
              }
            }
          };
        }
      }]);
  
      return I18n;
    })();
  }