diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-23 23:06:10 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-23 23:06:10 +0100 |
commit | 2bb2a2a330ca065fdf8a928c9eb22660578951c7 (patch) | |
tree | 4de7451a65cd954f83e434eee813cfb0950ede3c /lib/generators/website.js | |
parent | f12163534d877f627dbbf25eb455cb851e821f31 (diff) | |
download | gitbook-2bb2a2a330ca065fdf8a928c9eb22660578951c7.zip gitbook-2bb2a2a330ca065fdf8a928c9eb22660578951c7.tar.gz gitbook-2bb2a2a330ca065fdf8a928c9eb22660578951c7.tar.bz2 |
Normalize language to support: "fr-FR"
Diffstat (limited to 'lib/generators/website.js')
-rw-r--r-- | lib/generators/website.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/generators/website.js b/lib/generators/website.js index 5dffd14..bb2daa1 100644 --- a/lib/generators/website.js +++ b/lib/generators/website.js @@ -70,6 +70,8 @@ Generator.prototype.prepareTemplateEngine = function() { return fs.readdir(path.resolve(__dirname, "../../theme/i18n")) .then(function(locales) { + var language = that.book.config.normalizeLanguage(); + locales = _.chain(locales) .map(function(local) { local = path.basename(local, ".json"); @@ -78,8 +80,8 @@ Generator.prototype.prepareTemplateEngine = function() { .object() .value(); - if (!_.contains(_.keys(locales), that.options.language)) { - that.book.logWarn("Language '"+that.options.language+"' is not available as a layout locales ("+_.keys(locales).join(", ")+")"); + if (!_.contains(_.keys(locales), language) && language != "en") { + that.book.logWarn("Language '"+language+"' is not available as a layout locales (en, "+_.keys(locales).join(", ")+")"); } var folders = _.chain(that.templates) @@ -215,7 +217,7 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate) title: that.options.title, description: that.options.description, - language: that.options.language, + language: that.book.config.normalizeLanguage(), glossary: that.book.glossary, |