You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by dz...@apache.org on 2021/07/09 11:48:04 UTC
[drill] branch gh-pages updated: Add docs and error message for
parent-and-children page translations.
This is an automated email from the ASF dual-hosted git repository.
dzamo pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/gh-pages by this push:
new 7000b2a Add docs and error message for parent-and-children page translations.
7000b2a is described below
commit 7000b2ab5993fb2b649b136ab2061ec141cb808c
Author: James Turton <ja...@somecomputer.xyz>
AuthorDate: Fri Jul 9 13:46:28 2021 +0200
Add docs and error message for parent-and-children page translations.
---
README.md | 2 +-
_tools/createdatadocs.py | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 5d87b02..e230317 100644
--- a/README.md
+++ b/README.md
@@ -144,7 +144,7 @@ The English versions of "site" pages such as index.html are stored in the root d
## Add translated collection pages
-The English versions of "collection" pages such as the markdown under _docs/ are stored in an en/ subdirectory of the collection root. Create corresponding translated pages in the collection under `lang-code/` in which you translate both `title` and `parent` in the front matter but leave the `slug` the same as the English page and set `lang` to `lang-code`.
+The English versions of "collection" pages such as the markdown under _docs/ are stored in an en/ subdirectory of the collection root. Create corresponding translated pages in the collection under `lang-code/` in which you translate both `title` and `parent` in the front matter but leave the `slug` the same as the English page and set `lang` to `lang-code`. Once you've translated the `title` of a parent page, you will need to provide files for each of its children (which can still cont [...]
# Compiling the Website
diff --git a/_tools/createdatadocs.py b/_tools/createdatadocs.py
index d541a5c..9b22a33 100755
--- a/_tools/createdatadocs.py
+++ b/_tools/createdatadocs.py
@@ -82,7 +82,20 @@ if __name__ == '__main__':
if doc['parent'] == '':
top_level_docs.append(doc)
else:
- docs_by_title[doc['parent']]['children'].append(doc)
+ try:
+ docs_by_title[doc['parent']]['children'].append(doc)
+ except Exception as e:
+ msg = f'Error processing "{doc["title"]}", which has parent ' \
+ f'"{doc["parent"]}", for language {lang}.'
+
+ if lang != 'en':
+ msg += ' Once you\'ve given a translated _title_ to a parent page' \
+ ' you must create translations of all of its child pages' \
+ ' (which may be empty or contain the original English text)' \
+ ' and set their _parent_ to the new _title_ on the parent page'
+
+ logging.error(msg)
+ raise e
for doc in top_level_docs:
add_docs(docs_in_order, doc)