-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs.py script to support localization build (static and live) #313
Conversation
✅ Deploy Preview for grist-help-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
7b3cf9d
to
88aab30
Compare
This required to upgrade mkdocs in order to have the same API as FastAPI
88aab30
to
e984bdd
Compare
a31b8f4
to
763e3ec
Compare
18680cf
to
eac7a63
Compare
eac7a63
to
b34451a
Compare
8f35499
to
983bc87
Compare
983bc87
to
e8a5733
Compare
mkdocs-utils/hooks.py
Outdated
return files | ||
|
||
|
||
def generate_renamed_section_items( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read again my code after the weekend and found that I missed that part.
This part is meant to localize the section titles and the pages.
Whereas Fastapi handles localizing the sections by having an index.md
file per section (for example tutorial in en and in fr), grist-help doesn't. Also it works for the files in FastAPI because they are only described only with their names at the contrary of what is done in grist-help.
I am removing this function and the hook (at least for now), and will try to find a way to translate the sections later.
We'll find a way to translate sections later
@@ -4,7 +4,7 @@ If you are keeping records of who is charged what in Grist, it can be convenient | |||
to generate invoices right there and then beside those records. This tutorial | |||
shows you how to set up a document like this: | |||
|
|||
![Invoice](/examples/images/2020-08-invoices/final-invoice.png) | |||
![Invoice](../examples/images/2020-08-invoices/final-invoice.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are inside /examples
folder, why not write ./images/2020-08-invoices/final-invoice.png
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have same shape with newsletters folder ? Do you know why there is images in examples folder and directly in en/docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that it's specific to examples. That being said, probably these images could be moved to ./help/en/docs/images/examples/
.
Grist Labs: what do you think of that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c17431e
to
026f9d9
Compare
cf721bd
to
6a7037f
Compare
6a7037f
to
06b04dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, everything is working for me in testing. Some comments.
In order to build the website with all the languages, run: | ||
```sh | ||
source ./env/bin/activate | ||
./docs.py serve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That command says Make sure you run the build-all command first
, should that be added first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be fixed in: 10aa15b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fflorent ! I think this is good to land. Thanks for doing this all carefully and incrementally.
This PR takes the docs.py script from FastAPI and adapt it to make it work here.
Also just like the previous PR, you may merge it if you approve, it is meant to have no consequence on the resulting website.
Here is what docs.py offers:
Untranslated page fallback to the English version, with a warning asking for help to translate the content. Also images / screenshots can be localized too! They just have to be put in the
./help/{language}/docs/images
folder. If they are missing, the image from./help/en/docs/images
is used. All of this thanks to the mkdocs hooks!How it looks like
A page with untranslated content looks like this:
The language selector
Also implemented the selectbox that switches the language (to make it work, run:
./docs.py build-all
and then./docs.py serve
):recording.mp4
TODO
Old todo list:
build-doc.sh
new_lang
,build_lang
, ...)docs.py
without any change)