Skip to content

📝 Update prompts and German translation#14015

Merged
tiangolo merged 213 commits intofastapi:masterfrom
nilslindemann:update-prompts-and-german-translation
Sep 20, 2025
Merged

📝 Update prompts and German translation#14015
tiangolo merged 213 commits intofastapi:masterfrom
nilslindemann:update-prompts-and-german-translation

Conversation

@nilslindemann
Copy link
Contributor

@nilslindemann nilslindemann commented Aug 25, 2025

Setting it to draft temporarily to run one final language translation on the current state, to test if the prompts are good.

What I have done 💪

I have let the AI retranslate all the German documents, at least twice per document, and at least once with GPT 5. In the first run I mostly used GPT 4o and a few times GPT 5, with prompt modifications in-between, learning from GPTs output (and vice versa I guess). In the second run, which was a batch run without prompt modifications in-between, I used GPT 5 (Plot twist, it does the job better [1]). I diffed both against the English document and the previous translation, sometimes doing global changes in the German docs on the way. I did not look at parts which were white in the previous-translationnew translation diff (= unchanged parts), as I translated most of them a few months ago, reviewing them back then. But I used white parts in the English documentnew translation diff, to see if critical changes in the previous-translationnew translation diff, like changes in code includes, are good and bring things in sync.

What the PR changes 🔨

This PR applies all changes of #13993 (merged), #13968, #13931, #13929 (closed, will be done here), #13930 (closed, will be done here) before it adds changes on top. I later apply @svlandeg's suggestions in the permalink PR (#13993) and manually fix outdated permalinks. The second batch run showed that the permalinks are in sync. The PR makes:

  • heavy changes to the general prompt in the translate.py
  • heavy changes to docs/de/llm-prompt.md, which is the German LLM prompt, which gets appended to the general prompt in the translate.py.
  • lots of changes to the German documents under docs/de/docs, to bring them in sync with the English docs (adding a few abbrs on top)

Outdated

  • It also adds/fixes some things in the code of translate.py
    • Edit: Let's handle these in another PR. they are not relevant for this PR.
  • a few changes to English documents under docs/en/docs, mostly fixes.
  • I have added a file docs/en/docs/_llm-test.md, which can be used to test the prompt. The German translation of it is also included

How to review 💪

The Commits start clean, but sometimes get a bit messy towards the end, especially those made late at night 😅. Sorry about that. I suggest to not go through the PR commit-by-commit, but all-in-one, by using the Files changed tab, because some files are changed more than once in more than one commit, sometimes overwriting changes of previous commits. I suggest directly comparing those German translations which have many changes with the English document.

The result 😲

After this PR, all 111 112 (I have added a test document) translatable English documents have their in-sync German translation.

Credits 🤝

Thanks to @tiangolo, @YuriiMotov, @alejsdev and everyone else for their friendly support.

Footnote 📓

[1] GPT 5's changes are approximately 90% fixes and good changes, approximately 5% are unnecessary changes and approximately 5% are changes which have to be manually edited or reverted. GPT 4 does more unnecessary changes, resulting in, on average, twice as big diffs. GPT 5 understands complex prompt instructions better than GPT 4 and applies them more precise.

So that the LLM really does not do that (it sometimes did)
More to come soon
index.md is already up to date, no changes
The previous commit message should have been:

Update advanced/additional-responses.md

Time to make a break XD
The previous commit title should again have been:

Update advanced/advanced-dependencies.md
Exchange rule 4 and 5 and then exclude additional abbr's (abbr's without an english equivalent) from the list of abbr's which shall always be updated, as the LLM has nothing to diff against in this case. There were cases where it removed good information, which I had to undo, see e.g. the changes in `tutorial\query-param-models.md` in the two previous commits.
* "Die API-App abliefern" sounds funny, allow "Die API-Anwendung abliefern"
* "Leistung" instead of "Performanz" is usually smoother, we just dont want "Performance" (which is an artistic act) instead of "Performanz".
It should replace «"car"» with «„Auto“» but leave «`"car"`» as is (and not convert it to e.g. «„car“»). After this change it seems to finally have grasped that rule, at least according to my tests in a few documents, where it previously seemingly randomly did this wrong.
These changes are now handled in fixes-in-english-docs (fastapi#14048).
Let's handle these changes in another PR.

Except the modifications in the prompt, this translate.py is now in sync with the translate.py in update-translations-prompt (fastapi#13968).
@github-actions github-actions bot added the lang-all Translations label Sep 6, 2025
@github-actions

This comment was marked as outdated.

@nilslindemann nilslindemann marked this pull request as ready for review September 6, 2025 13:04
@nilslindemann
Copy link
Contributor Author

Okay, that final retranslation went smooth. There were two issues which I addressed doing a few changes in the prompt and a few more which I manually edited. Most were fixes by the LLM. I removed the parts which will be done in other PRs. If there are no other issues, I give my OK for merging. 🚀

Can someone take a look at the failed test? It seems to have a problem with the lang-all tag, which the bot added.

@YuriiMotov, can you take a look at the final changes in the general prompt?

@tiangolo, shall we apply the changes in the German prompt here or in #13931?

YuriiMotov added a commit to YuriiMotov/fastapi that referenced this pull request Sep 8, 2025
@YuriiMotov
Copy link
Member

Thanks!

I applied latest changes to translation script in #13968

As for labels - don't worry about this, we will remove docs label before merging. This PR will be translation PR and lang-all is a proper label.

Reminder: don't forget to revert changes to docs/ru/llm-prompt.md

I needed it to run test Russian translations.
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@nilslindemann
Copy link
Contributor Author

Thanks Yurii, good catch.

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions
Copy link
Contributor

📝 Docs preview for commit 1e514f3 at: https://d7427d41.fastapitiangolo.pages.dev

Modified Pages

Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Amazing, fantastic job @nilslindemann, thanks a lot! 🙌

And also thanks @YuriiMotov for all the help with this. 🍰

@tiangolo tiangolo added lang-de German translations and removed docs Documentation about how to use FastAPI labels Sep 20, 2025
@tiangolo tiangolo merged commit 9b1234d into fastapi:master Sep 20, 2025
57 of 59 checks passed
@nilslindemann
Copy link
Contributor Author

Awesome, always nice to have such a big PR done, I hope it was not too much work to review, Tiangolo. Also thanks Yurii.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang-all Translations lang-de German translations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants