gitbook_multilanguage_template
  • README
  • LANGS
  • README
    • gitbook_markdown
    • GitBook 多语言模板
    • 目录
    • GitBook && GitHub
  • node_modules
    • Mermaid plugin for GitBook
      • node_modules
        • README
          • node_modules
            • README
              • Changelog
            • mkdirp
              • readme
              • node_modules
                • minimist
                  • readme
            • chalk
              • node_modules
                • has-ansi
                  • node_modules
                    • ansi-regex
                      • ansi-regex
                  • has-ansi
                • ansi-styles
                  • ansi-styles
                • strip-ansi
                  • node_modules
                    • ansi-regex
                      • ansi-regex
                  • strip-ansi
                • escape-string-regexp
                  • escape-string-regexp
                • supports-color
                  • supports-color
              • readme
            • he
            • which
              • node_modules
                • is-absolute
                  • node_modules
                    • is-relative
                • isexe
            • dagre - Graph layout for JavaScript
              • node_modules
                • lodash v3.10.1
                • README
            • dagre-d3 - A D3-based renderer for dagre
              • node_modules
                • lodash v3.10.1
                • README
            • semver(1) -- The semantic versioner for npm
            • minimist
              • readme
            • Data-Driven Documents
              • Contributing
          • build
            • content
              • usage
              • Development
              • Upgrading to from version -0.4.0
              • Gant diagrams
              • Sequence diagrams
              • index
              • Flowcharts - Basic Syntax
              • Demos
              • mermaid CLI
              • mermaidAPI
          • docs
            • content
              • mermaid CLI
              • usage
              • Development
              • Upgrading to from version -0.4.0
              • Gant diagrams
              • index
              • Sequence diagrams
              • Flowcharts - Basic Syntax
              • Demos
          • Change Log
          • CONTRIBUTING
          • src
            • diagrams
              • gantt
                • exGantt
    • gitbook-plugin-todo
      • node_modules
        • cheerio
          • CONTRIBUTING
          • node_modules
            • htmlparser2
              • node_modules
                • domhandler
                  • DOMHandler
                • domutils
                  • readme
                • readable-stream
                  • node_modules
                    • core-util-is
                    • isarray
                    • README
                    • README
                • domelementtype
                  • readme
                • entities
                  • entities
            • lodash v3.10.1
            • css-select
              • node_modules
                • domutils
                  • node_modules
                    • domelementtype
                      • readme
                  • readme
                • boolbase
                • css-what
                  • css-what
                • nth-check
            • entities
              • entities
            • dom-serializer
              • node_modules
                • domelementtype
                  • readme
          • History
          • cheerio
        • README
    • gitbook-plugin-toc
      • node_modules
        • marked-toc
          • node_modules
            • Uslug.js
              • node_modules
                • README
                  • LICENSE
            • template
              • node_modules
                • fs-utils
                  • node_modules
                    • JS-YAML - YAML 1.2 parser and serializer for JavaScript
                      • node_modules
                        • README
                          • node_modules
                            • underscore.string
                              • Underscore.string #
                            • README
                          • HISTORY
                        • README
                      • HISTORY
                    • globule
                      • node_modules
                        • minimatch
                          • node_modules
                            • lru cache
                            • sigmund
                        • Glob
                          • node_modules
                            • minimatch
                              • node_modules
                                • lru cache
                                • sigmund
                            • README
                      • test
                        • fixtures
                          • README
                    • graceful-fs
                    • mkdirp
                      • readme
                    • Async.js
                    • README
                  • test
                    • fixtures
                      • foo
                • delims
                • underscore.string
                  • Underscore.string #
            • fs-utils
              • node_modules
                • JS-YAML - YAML 1.2 parser / writer for JavaScript
                  • node_modules
                    • README
                      • CHANGELOG
                      • node_modules
                        • README
                    • README
                  • CHANGELOG
                • delete
                  • node_modules
                    • README
                      • node_modules
                        • Glob
                          • node_modules
                            • inflight
                              • node_modules
                                • wrappy
                            • minimatch
                              • node_modules
                                • brace-expansion
                                  • node_modules
                                    • balanced-match
                                      • LICENSE
                                    • concat-map
                                      • README
                            • README
                            • once
                              • node_modules
                                • wrappy
                            • path-is-absolute
                              • path-is-absolute
                          • changelog
                    • is-path-in-cwd
                      • node_modules
                        • is-path-inside
                          • is-path-inside
                          • node_modules
                            • Is This Path Inside This Other Path?
                      • is-path-in-cwd
                    • is-path-cwd
                      • is-path-cwd
                  • {%= name %} {%= badge("fury") %}
                • is-absolute
                  • node_modules
                    • is-relative
                • globby
                  • node_modules
                    • README
                      • node_modules
                        • once
                          • node_modules
                            • wrappy
                        • minimatch
                          • node_modules
                            • brace-expansion
                              • node_modules
                                • balanced-match
                                  • LICENSE
                                • concat-map
                                  • README
                        • inflight
                          • node_modules
                            • wrappy
                        • README
                    • array-union
                      • node_modules
                        • array-uniq
                          • array-uniq
                      • array-union
                    • array-differ
                      • array-differ
                  • globby
                • Async.js
                • kind-of
                  • {%= name %} {%= badge("fury") %}
                • extend-shallow
                  • node_modules
                    • array-slice
                  • {%= name %} {%= badge("fury") %}
                • relative
                  • {%= name %} {%= badge("fury") %}
                  • node_modules
                    • normalize-path
                      • {%= name %} {%= badge("fury") %}
                • graceful-fs
              • test
                • fixtures
                  • foo
              • {%= name %} {%= badge("fury") %}
            • gray-matter
              • test
                • fixtures
                  • autodetect-javascript
                  • autodetect-no-lang
                  • This page has JSON front matter!
                  • autodetect-coffee
                  • This page has YAML front matter!
                  • autodetect-json
                  • autodetect-yaml
                  • has-matter
                  • to-json
                  • delims-custom
                  • lang-toml
                  • to-yaml
                  • autodetect-coffee-fn
                  • This file doesn't have matter!
                  • autodetect-toml
                  • autodetect-cson-fn
                  • delims-semi-colons
                  • lang-coffee-fn
                  • lang-javascript-fn
                  • complex
                  • lang-cson-fn
                  • This page has cson front matter!
                  • empty
                  • delims-and-lang
                  • This page has coffee front matter!
                  • autodetect-cson
              • {%= name %} {%= badge("fury") %}
              • node_modules
                • README
                  • node_modules
                    • arrayify-compact
                      • node_modules
                        • Array Flatten
                      • {%= name %} {%= badge("fury") %}
                    • object-pick
                • mixin-deep
                  • node_modules
                    • is-plain-object
                      • {%= name %} {%= badge("fury") %}
                    • for-own
                      • node_modules
                        • for-in
                  • {%= name %} {%= badge("fury") %}
                • verbalize
                  • node_modules
                    • chalk
                      • readme
                      • node_modules
                        • ansi-styles
                          • ansi-styles
                        • strip-ansi
                          • strip-ansi
                        • has-color
                          • has-color
                  • docs
                    • install
                    • {%= name %} {%= badge('fury') %}
                • JS-YAML - YAML 1.2 parser / writer for JavaScript
                  • node_modules
                    • README
                      • CHANGELOG
                      • node_modules
                        • README
                    • README
                  • CHANGELOG
                • TOML Parser for Node.js
                  • CHANGELOG
                • README
                  • How to contribute to CoffeeScript
              • docs
                • examples
                • why
                • options
            • marked
            • Lo-Dash v2.4.2
          • test
            • actual
              • Test
              • Handlebars-Helper
              • Related-Grunt-Tasks
              • Repos-List
              • Examples
              • Readme-Repos-List
              • toc
              • Foo
              • Readme3
              • Readme2
              • Readme-Repos
              • Readme1
              • Related-Repos
              • Badge-Mixins
              • Test
            • fixtures
              • repos-list
              • handlebars-helper
              • examples
              • related-grunt-tasks
              • grunt-readme
              • Contains toc stop comment
              • grunt-readme
              • Badges
              • Examples
              • marked-toc
              • Documentation
              • Test
              • grunt-readme
              • grunt-readme
              • Contains extra comment
              • related-repos
              • grunt-readme
    • GitBook Plugin: Advanced Emoji
      • node_modules
        • emojify.js
          • LICENSE
          • LICENSE-IMAGES
          • Contributing
      • assets
        • LICENSE-IMAGES
        • LICENSE
      • Howto Publish to npmjs.org
    • gitbook-plugin-chart
      • node_modules
        • JS-YAML - YAML 1.2 parser / writer for JavaScript
          • node_modules
            • README
            • README
              • CHANGELOG
              • node_modules
                • README
          • CHANGELOG
    • gitbook-plugin-search-pro
      • node_modules
        • README
          • node_modules
            • nan
              • doc
                • Scopes
                • Strings & Bytes
                • Maybe Types
                • New
                • Object Wrappers
                • V8 internals
                • Persistent references
                • Asynchronous work helpers
                • Converters
                • Buffers
                • JavaScript-accessible methods
                • Script
                • Errors
                • Nan::Callback
                • Miscellaneous V8 Helpers
                • Miscellaneous Node Helpers
              • The MIT License (MIT)
              • README
              • NAN ChangeLog
          • README_EN
          • NodeJieba ChangeLog
        • lodash v3.10.1
    • Math typesetting using KaTex
      • node_modules
        • README
          • node_modules
            • match-at
          • README
    • Emphasize texts in GitBook
    • Disqus integration for GitBook
  • README
    • GitBook 多言語対応テンプレート
    • GitBook && GitHub
    • カタログ
    • gitbook_markdown
  • README
    • GitBook && GitHub
    • Table of content
    • gitbook_markdown
    • GitBook Multilanguage Template
Powered by GitBook
On this page
  • GitBook Folder Structure
  • LANGS.md
  • GitBook-Plugins
  • NOTE

Was this helpful?

  1. README

GitBook Multilanguage Template

GitBook Folder Structure

+ gitbook_learn
  - cover.jpg               => book cover
  - cover_small.jpg         => book cover small
  - book.json               => book info config for common use
  - LANGS.md                => multiple languages definition
  - README.md               => README.md for Github
  + en                      => folder for books content in English
    - book.json                 => book info config for this language only
    - README.md
    - SUMMARY.md
  + zh-hans                 => folder for books content in Chinese
    - book.json                 => book info config for this language only
    - README.md
    - SUMMARY.md
  + ja                      => folder for books content in Japanese
    - book.json                 => book info config for this language only
    - README.md
    - SUMMARY.md
  + node_modules            => all gitbook plugins are here
  + _book                   => generated books

LANGS.md

* [English](en)
* [中文](zh-hans)
* [日本語 (にほんご)](ja)

GitBook-Plugins

All the languages can share the same plugins which means that we only need to install the plugin once.

So we need a book.json for all plugins :

{ 
    "plugins" : 
    [
        "advanced-emoji",
        "disqus",
        "todo",
        "emphasize",
        "katex",
        "mermaid-compat",
        "chart",
        "search-pro"
    ],
    "pluginsConfig": 
    {
        "sharing": {
            "weibo": true,
            "facebook": true,
            "twitter": true
        },
        "disqus": {
            "shortName": "xxxxxx"
        },
        "search-pro": {
            "cutWordLib": "nodejieba"
        }
    }
}

Then we can run gitbook install to install all the plugins we need.

For each different languages, we can overwirte the book.json.

eg zh-hans/book.json:

{
    "author": "SuperSuRaccoon",
    "links": {
        "sidebar": {
            "我的博客": "http://www.supersuraccoon-cocos2d.com"
        }
    },
    "plugins" : 
    [
        "advanced-emoji",
        "disqus",
        "todo",
        "emphasize",
        "katex",
        "mermaid-compat",
        "chart",
        "search-pro",
        "-search"
    ],
    "pluginsConfig": 
    {
        "sharing": {
            "weibo": true,
            "facebook": false,
            "twitter": false
        },
        "disqus": {
            "shortName": "xxxxxx_zh"
        }
    }
}

eg en/book.json:

{
    "author": "SuperSuRaccoon",
    "links": {
        "sidebar": {
            "My Blog": "http://www.supersuraccoon-cocos2d.com"
        }
    },
    "plugins" : 
    [
        "advanced-emoji",
        "disqus",
        "todo",
        "emphasize",
        "katex",
        "mermaid-compat",
        "chart",
        "-search-pro"
    ]
}

NOTE

For the plugins field, we need to list all the plugins since its a array filed and the plugins list in the common book.json will be overwritten.

For the pluginsConfig field, we only need to add or change the config that is different from in the common book.json since its a dict field .

It seems like gitbook build will copy all the plugins needed to each language folder (under gitbook/plugins) so now plugin advanced-emoji for example will have 4 copies -- 3 for languages zh en ja and one for the root folder.

Conclusion

We add all the plugins in the root/book.json and install them only once.

For each language, we list all the plugins we need (or remove using -) and overwrite pluginsConfig if any.

Previousgitbook_markdown

Last updated 5 years ago

Was this helpful?