Skip to content
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 Persian translation for docs/fa/docs/index.md and tweak right-to-left CSS #2395

Merged
merged 8 commits into from Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/notify-translations/app/translations.yml
Expand Up @@ -8,7 +8,7 @@ uk: 1748
tr: 1892
fr: 1972
ko: 2017
sq: 2041
fa: 2041
pl: 3169
de: 3716
id: 3717
Expand Down
1 change: 1 addition & 0 deletions docs/en/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/es/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
15 changes: 15 additions & 0 deletions docs/fa/docs/css/rtl.css
@@ -0,0 +1,15 @@
.termy{
direction: ltr;
}
code{
direction: ltr;
display: inline-block;
}
mohsen-mahmoodi marked this conversation as resolved.
Show resolved Hide resolved
.external-link{
direction: ltr;
display: inline-block;
}
mohsen-mahmoodi marked this conversation as resolved.
Show resolved Hide resolved

.md-content__inner h1{
direction: ltr !important;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see that most of these settings only set some elements to always be ltr, I think it would be safe to move them to the main CSS (at docs/en/docs/css/custom.css). That file is then copied to all the languages.

Also because when the MkDocs configs are regenerated the custom CSS for Persian would be overridden, so, if these CSS styles can be put in a way that applies to everything, it will all work correctly. But if it's absolutely needed to have custom CSS styles only for right-to-left languages, then I would need to figure out a way to support it in the scripts that generate the multi-language docs. 😬

But that would also depend on if the display: inline-block; are necessary or not...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the changes that make some styles ltr are safe in every other language and it makes sense because they are applied to codes and links and these two items are always ltr, no matter what the language is. But I will pull the latest changes and check if everything is OK before resolving this thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked it. Yes it is totally safe to move these ltr changes to the main CSS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to check the latest changes and then reverted my branch to the final changes you made.

459 changes: 459 additions & 0 deletions docs/fa/docs/index.md

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions docs/fa/mkdocs.yml
@@ -0,0 +1,90 @@
site_name: FastAPI
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
site_url: https://fastapi.tiangolo.com/fa/
theme:
name: material
palette:
- scheme: default
primary: teal
accent: amber
toggle:
icon: material/lightbulb-outline
name: Switch to light mode
- scheme: slate
primary: teal
accent: amber
toggle:
icon: material/lightbulb
name: Switch to dark mode
features:
- search.suggest
- search.highlight
icon:
repo: fontawesome/brands/github-alt
logo: https://fastapi.tiangolo.com/img/icon-white.svg
favicon: https://fastapi.tiangolo.com/img/favicon.png
language: fa
repo_name: tiangolo/fastapi
repo_url: https://github.com/tiangolo/fastapi
edit_uri: ''
google_analytics:
- UA-133183413-1
- auto
plugins:
- search
- markdownextradata:
data: data
nav:
- FastAPI: index.md
- Languages:
- en: /
- es: /es/
- fa: /fa/
- fr: /fr/
- it: /it/
- ja: /ja/
- ko: /ko/
- pt: /pt/
- ru: /ru/
- tr: /tr/
- uk: /uk/
- zh: /zh/
markdown_extensions:
- toc:
permalink: true
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite
- extra
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_div_format ''
- pymdownx.tabbed
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/tiangolo
- icon: fontawesome/brands/dev
link: https://dev.to/tiangolo
- icon: fontawesome/brands/medium
link: https://medium.com/@tiangolo
- icon: fontawesome/solid/globe
link: https://tiangolo.com
extra_css:
- https://fastapi.tiangolo.com/css/termynal.css
- https://fastapi.tiangolo.com/css/custom.css
- https://fastapi.tiangolo.com/css/rtl.css

extra_javascript:
- https://unpkg.com/mermaid@8.4.6/dist/mermaid.min.js
- https://fastapi.tiangolo.com/js/termynal.js
- https://fastapi.tiangolo.com/js/custom.js
1 change: 1 addition & 0 deletions docs/fr/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/it/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/ja/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/ko/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/pt/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/ru/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/tr/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/uk/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down
1 change: 1 addition & 0 deletions docs/zh/mkdocs.yml
Expand Up @@ -40,6 +40,7 @@ nav:
- az: /az/
- de: /de/
- es: /es/
- fa: /fa/
- fr: /fr/
- id: /id/
- it: /it/
Expand Down