From 8ff619d95eb21f74ac0a1ef97b8313c5d25e029d Mon Sep 17 00:00:00 2001 From: Kevin Canwen Xu Date: Fri, 30 Jul 2021 20:56:14 +0800 Subject: [PATCH] Add multilingual documentation support (#12952) * Add multilingual documentation support * Add multilingual documentation support * make style * make style * revert --- docs/source/conf.py | 3 +++ setup.py | 2 ++ src/transformers/dependency_versions_table.py | 1 + 3 files changed, 6 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5767f52671..30e1582aca 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -208,6 +208,9 @@ epub_title = project # A list of files that should not be packed into the epub file. epub_exclude_files = ["search.html"] +# Localization +locale_dirs = ['locale/'] +gettext_compact = False def setup(app): app.add_css_file("css/huggingface.css") diff --git a/setup.py b/setup.py index 39bfacfef3..228ec889d7 100644 --- a/setup.py +++ b/setup.py @@ -142,6 +142,7 @@ _deps = [ "sphinx-rtd-theme==0.4.3", # sphinx-rtd-theme==0.5.0 introduced big changes in the style. "sphinx==3.2.1", "sphinxext-opengraph==0.4.1", + "sphinx-intl", "starlette", "tensorflow-cpu>=2.3", "tensorflow>=2.3", @@ -289,6 +290,7 @@ extras["docs_specific"] = deps_list( "sphinx-rtd-theme", "sphinx-copybutton", "sphinxext-opengraph", + "sphinx-intl", ) # "docs" needs "all" to resolve all the references extras["docs"] = extras["all"] + extras["docs_specific"] diff --git a/src/transformers/dependency_versions_table.py b/src/transformers/dependency_versions_table.py index 1b74a896d7..7ad52c608c 100644 --- a/src/transformers/dependency_versions_table.py +++ b/src/transformers/dependency_versions_table.py @@ -59,6 +59,7 @@ deps = { "sphinx-rtd-theme": "sphinx-rtd-theme==0.4.3", "sphinx": "sphinx==3.2.1", "sphinxext-opengraph": "sphinxext-opengraph==0.4.1", + "sphinx-intl": "sphinx-intl", "starlette": "starlette", "tensorflow-cpu": "tensorflow-cpu>=2.3", "tensorflow": "tensorflow>=2.3",