Browse Source

Update prompts

pull/14015/head
Nils Lindemann 3 days ago
parent
commit
018f8523ff
  1. 609
      docs/de/llm-prompt.md
  2. 663
      scripts/translate.py

609
docs/de/llm-prompt.md

@ -1,422 +1,345 @@
1) Translate to German (Deutsch).
### Target language
Language code: de.
2) Use the formal grammar (use `Sie` instead of `Du`).
3) Convert quotation marks (") to typographic quotation marks („“).
Example:
Source (English):
"Hello world"
Result (German):
„Hallo Welt“
3.1) Inside inline code (= surrounded by backticks), leave quotation marks (") as is, as they usually mark string literals and typographic quotation marks („“) can not be used for that.
Example:
Source (English) – contains four inline codes, three of them contain a string literal:
Inline code: `i am inline code`
Inline code containing a string literal: `i am inline code "I am a string literal"`
Inline code containing only a short string literal: `"foo"`
`"__main__"`
Result (German) – as all the quotation marks (") are inside inline code, you keep them as is, as you always should with content inside inline code:
Inline-Code: `i am inline code`
Inline-Code der ein Stringliteral enthält: `i am inline code "I am a string literal"`
Inline-Code der nur ein kurzes Stringliteral enthält: `"foo"`
`"__main__"`
4) make sure there is a space between an ellipsis and a word following or preceding it.
Examples:
Source (English):
...as we intended.
...this would work:
...etc.
others...
More to come...
Result (German):
... wie wir es beabsichtigt hatten.
... das würde funktionieren:
... usw.
Andere ...
Später mehr ...
4.1) Rule 4 does not apply in URLs, code blocks, inline code. Do not change the spaces there.
5) Translate HTML abbr elements as follows:
5.1) If the title attribute gives the full phrase for an abbreviation, then keep the phrase, append a long dash (`–`), followed by the translation of the phrase.
Examples:
Source (English):
<abbr title="Internet of Things">IoT</abbr>
<abbr title="Central Processing Unit">CPU</abbr>
<abbr title="too long; didn't read"><strong>TL;DR:</strong></abbr>
Result (German):
<abbr title="Internet of Things – Internet der Dinge">IoT</abbr>
<abbr title="Central Processing Unit – Zentrale Verarbeitungseinheit">CPU</abbr>
<abbr title="too long; didn't read – zu lang; hab's nicht gelesen"><strong>TL;DR:</strong></abbr>
Conversion scheme title attribute:
Translate to German (Deutsch).
Source (English):
{full phrase}
Result (German):
{full phrase} – {translation of full phrase}
5.1.1) If the phrase can not be translated, or it is the same in the translation, then keep the title attribute as is.
Examples:
Source (English):
<abbr title="JSON Web Tokens">JWT</abbr>
<abbr title="Enumeration">`Enum`</abbr>
Result (German):
<abbr title="JSON Web Tokens">JWT</abbr>
<abbr title="Enumeration">`Enum`</abbr>
Conversion scheme title attribute:
Source (English):
{full phrase}
Result (German):
{full phrase}
5.1.2) If the phrase can be translated and that translation has the same starting letters, then just use the translation.
Examples:
Language code: de.
Source (English):
<abbr title="Asynchronous Server Gateway Interface">ASGI</abbr>
### Definitions
Result (German):
hyphen
The character «-»
Unicode U+002D (HYPHEN-MINUS)
Alternative names: hyphen, dash, minus sign
<abbr title="Asynchrones Server-Gateway-Interface">ASGI</abbr>
dash
The character «–»
Unicode U+2013 (EN DASH)
German name: Halbgeviertstrich
Conversion scheme title attribute:
Source (English):
### Grammar to use when talking to the reader
{full phrase}
Use the formal grammar (use «Sie» instead of «Du»).
Result (German):
{translation of full phrase}
### Quotes
5.2) If the title attribute explains something in its own words, then translate it, if possible.
1) Convert neutral double quotes («"» and «"») and English double typographic quotes («“» and «”») to German double typographic quotes («„» and «“»). Convert neutral single quotes («'» and «'») and English single typographic quotes («‘» and «’») to German single typographic quotes («‚» and «‘»).
Examples:
Source (English):
Source (English):
<abbr title="also known as: endpoints, routes">path</abbr>
<abbr title="A program that checks for code errors">linter</abbr>
<abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>
<abbr title="before 2023-03">0.95.0</abbr>
<abbr title="2023-08-26">at the time of writing this</abbr>
«««
"Hello world"
“Hello Universe”
"He said: 'Hello'"
“my name is ‘Nils’”
»»»
Result (German):
Result (German):
<abbr title="auch bekannt als: Endpunkte, Routen">Pfad</abbr>
<abbr title="Programm das auf Fehler im Code prüft">Linter</abbr>
<abbr title="Konvertieren des Strings eines HTTP-Requests in Python-Daten">„Parsen“</abbr>
<abbr title="vor 2023-03">0.95.0</abbr>
<abbr title="2023-08-26">zum Zeitpunkt als das hier geschrieben wurde</abbr>
«««
„Hallo Welt“
„Hallo Universum“
„Er sagte: ‚Hallo‘“
„Mein Name ist ‚Nils‘“
»»»
Conversion scheme title attribute:
2) Inside code snippets and code blocks, leave neutral double quotes («"») and neutral single quotes («'») AS IS. Do NOT convert them to typographic quotes.
Source (English):
{explanation}
Result (German):
{translation of explanation}
5.2.1) If the term, which the HTML abbr element wraps, stays English in the translation, but it also has a translation, whose knowledge improves the explanation, then let the title attribute be that translation, followed by a colon (`:`), followed by the translation of the title attribute.
Examples:
Source (English):
<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>
Result (German):
<abbr title="Einbringen von Abhängigkeiten: auch bekannt als Komponenten, Ressourcen, Provider, Services, Injectables">Dependency Injection</abbr>
Example:
Conversion scheme title attribute:
Source (English) – contains four code snippets, three of them contain a string literal:
Source (English):
«««
Inline code: `i am inline code`
Inline code containing a string literal: `i am inline code "I am a string literal"`
Inline code containing only a short string literal: `"foo"`
`"__main__"`
`"fastapi[standard]"`
»»»
{explanation}
Result (German) – as all the quotes («"») are inside code snippets («`...`»), you keep them as is (as you always should do with content inside code snippets):
Result (German):
«««
Inline-Code: `i am inline code`
Inline-Code der ein Stringliteral enthält: `i am inline code "I am a string literal"`
Inline-Code der nur ein kurzes Stringliteral enthält: `"foo"`
`"__main__"`
`"fastapi[standard]"`
»»»
{translation of term which abbr wraps}: {translation of explanation}
### Ellipsis
5.3) If the title attribute gives the full phrase for an abbreviation, followed by a colon (`:`) or a comma (`,`), followed by an explanation, then keep the phrase, append a long dash (`–`), followed by the translation of the phrase, followed by a colon (`:`), followed by the translation of the explanation.
1) Make sure there is a space between an ellipsis and a word following or preceding the ellipsis.
Examples:
Source (English):
<abbr title="Input/Output: disk reading or writing, network communication.">I/O</abbr>
<abbr title="Content Delivery Network: Service, that provides static files.">CDN</abbr>
<abbr title="Integrated Development Environment, similar to a code editor">IDE</abbr>
<abbr title="Object Relational Mapper, a fancy term for a library where some classes represent SQL tables and instances represent rows in those tables">"ORMs"</abbr>
Result (German):
<abbr title="Input/Output – Eingabe/Ausgabe: Lesen oder Schreiben auf der Festplatte, Netzwerkkommunikation.">I/O</abbr>
<abbr title="Content Delivery Network – Inhalte auslieferndes Netzwerk: Dienst, der statische Dateien bereitstellt.">CDN</abbr>
<abbr title="Integrated Development Environment – Integrierte Entwicklungsumgebung: Ähnlich einem Code-Editor">IDE</abbr>
<abbr title="Object Relational Mapper – Objektrelationaler Mapper: Ein Fachbegriff für eine Bibliothek, in der einige Klassen SQL-Tabellen und Instanzen Zeilen in diesen Tabellen darstellen">„ORMs“</abbr>
Conversion scheme title attribute:
Source (English):
{full phrase}: {explanation}
OR
Source (English):
Source (English):
«««
...as we intended.
...this would work:
...etc.
others...
More to come...
»»»
{full phrase}, {explanation}
Result (German):
Result (German):
«««
... wie wir es beabsichtigt hatten.
... das würde funktionieren:
... usw.
Andere ...
Später mehr ...
»»»
{full phrase} – {translation of full phrase}: {translation of explanation}
2) This does not apply in URLs, code blocks, and code snippets. Do not remove or add spaces there.
5.4) If there is an HTML abbr element in a sentence in an existing translation, but that element does not exist in the related sentence in the English text, then keep that HTML abbr element in the translation, do not change or remove it. Except when you remove the whole sentence from the translation, because the whole sentence was removed from the English text. The reasoning for this rule is, that such abbr elements are manually added by the human editor of the translation, in order to translate or explain an English word to the human readers of the translation. They would not make sense in the English text, but they do make sense in the translation. So keep them in the translation, even though they are not part of the English text. This rule only applies to HTML abbr elements.
### Headings
6) Translate headings using the infinite form.
1) Translate headings using the infinite form.
Examples:
Source (English):
Source (English):
## Create a Project { #create-a-project }
«««
## Create a Project { #create-a-project }
»»»
Translate with (German):
Translate with (German):
## Ein Projekt erstellen { #create-a-project }
«««
## Ein Projekt erstellen { #create-a-project }
»»»
Do NOT translate with (German):
Do NOT translate with (German):
## Erstellen Sie ein Projekt { #create-a-project }
«««
## Erstellen Sie ein Projekt { #create-a-project }
»»»
Source (English):
Source (English):
# Install Packages { #install-packages }
«««
# Install Packages { #install-packages }
»»»
Translate with (German):
Translate with (German):
# Pakete installieren { #install-packages }
«««
# Pakete installieren { #install-packages }
»»»
Do NOT translate with (German):
Do NOT translate with (German):
# Installieren Sie Pakete { #install-packages }
«««
# Installieren Sie Pakete { #install-packages }
»»»
Source (English):
Source (English):
### Run Your Program { #run-your-program }
«««
### Run Your Program { #run-your-program }
»»»
Translate with (German):
Translate with (German):
### Ihr Programm ausführen { #run-your-program }
«««
### Ihr Programm ausführen { #run-your-program }
»»»
Do NOT translate with (German):
Do NOT translate with (German):
### Führen Sie Ihr Programm aus { #run-your-program }
«««
### Führen Sie Ihr Programm aus { #run-your-program }
»»»
6.1) Make sure that the translated part of the heading does not end with a period.
2) Make sure that the translated part of the heading does not end with a period.
Example:
Source (English):
Source (English):
## Another module with `APIRouter` { #another-module-with-apirouter }
«««
## Another module with `APIRouter` { #another-module-with-apirouter }
»»»
Translate with (German):
Translate with (German):
## Ein weiteres Modul mit `APIRouter` { #another-module-with-apirouter }
«««
## Ein weiteres Modul mit `APIRouter` { #another-module-with-apirouter }
»»»
Do NOT translate with (German) – notice the added period:
Do NOT translate with (German) – notice the added period:
## Ein weiteres Modul mit `APIRouter`. { #another-module-with-apirouter }
«««
## Ein weiteres Modul mit `APIRouter`. { #another-module-with-apirouter }
»»»
6.2) Replace occurrences of literal ` - ` (a space followed by a dash followed by a space) with ` – ` (a space followed by a long dash followed by a space) in the translated part of the heading.
3) Replace occurrences of literal « - » (a space followed by a hyphen followed by a space) with « – » (a space followed by a dash followed by a space) in the translated part of the heading.
Example:
Source (English):
Source (English):
# FastAPI in Containers - Docker { #fastapi-in-containers-docker }
«««
# FastAPI in Containers - Docker { #fastapi-in-containers-docker }
»»»
Translate with (German) – notice the long dash:
Translate with (German) – notice the dash:
# FastAPI in Containern – Docker { #fastapi-in-containers-docker }
«««
# FastAPI in Containern – Docker { #fastapi-in-containers-docker }
»»»
Do NOT translate with (German):
Do NOT translate with (German) – notice the hyphen:
# FastAPI in Containern - Docker { #fastapi-in-containers-docker }
«««
# FastAPI in Containern - Docker { #fastapi-in-containers-docker }
»»»
6.2.1) Do not apply rule 6.2 when there is no space before or after the dash.
3.1) Do not apply rule 3 when there is no space before or no space after the dash.
Example:
Source (English):
## Type hints and annotations { #type-hints-and-annotations }
Translate with (German) – use a short dash:
## Typhinweise und -annotationen { #type-hints-and-annotations }
Do NOT translate with (German):
## Typhinweise und –annotationen { #type-hints-and-annotations }
Rule 6.2 does not apply to the untranslated part of the heading inside curly brackets, which you shall not translate.
7) Follow these German instructions:
In der Regel versuche ich so weit wie möglich Worte zusammenzuschreiben, also ohne Bindestrich, es sei denn, es ist Konkretesding-Klassevondingen, etwa `Pydantic-Modell` (aber: `Datenbankmodell`), `Python-Modul` (aber: `Standardmodul`). Ich setze auch einen Bindestrich, wenn er die gleichen Buchstaben verbindet, etwa `Enum-Member`, `Cloud-Dienst`, `Template-Engine`. Oder wenn das Wort sonst einfach zu lang wird, etwa, `Performance-Optimierung`. Oder um etwas visuell besser zu dokumentieren, etwa `Pfadoperation-Dekorator`, `Pfadoperation-Funktion`.
Ich versuche nicht, alles einzudeutschen. Das bezieht sich besonders auf Begriffe aus dem Bereich der Programmierung. Ich wandele zwar korrekt in Großschreibung um und setze Bindestriche, wo notwendig, aber ansonsten lasse ich solch ein Wort unverändert. Beispielsweise wird aus dem englischen Wort `string` in der deutschen Übersetzung `String`, aber nicht `Zeichenkette`. Oder aus dem englischen Wort `request body` wird in der deutschen Übersetzung `Requestbody`, aber nicht `Anfragekörper`. Oder aus dem englischen `response` wird im Deutschen `Response`, aber nicht `Antwort`.
8) Below is a list of English terms and their German translations, separated by a colon (`:`). Use these translations, do not use your own. Words inside brackets are explanations for you, they are not part of the term or the translation. If a list item starts with `NOT`, then that means: do NOT use this translation. Nouns, starting with the word `the`, have their German genus – `der`, `die`, `das` – included, to help you to grammatically decline them in the translation, and they are given in singular case unless they have `(plural case)` attached, which means they are given in plural case. Verbs are given in the full infinitive – starting with the word `to`.
* /// check: /// check | Testen
* /// danger: /// danger | Gefahr
* /// info: /// info | Info
* /// note | Technical Details: /// note | Technische Details
* /// note: /// note | Hinweis
* /// tip: /// tip | Tipp
* /// warning: /// warning | Achtung
* you: Sie
* your: Ihr
* e.g: z. B.
* etc.: usw.
* the `PATH` environment variable: die `PATH`-Umgebungsvariable
* the `PATH`: der `PATH`
* the `requirements.txt`: die `requirements.txt`
* the API Router: der API-Router
* the app: die App
* the application: die Anwendung
* the Advanced User Guide: das Handbuch für fortgeschrittene Benutzer
* the Authorization-Header: der Autorisierungsheader
* the `Authorization`-Header: der `Authorization`-Header
* the background task: der Hintergrundtask
* the cloud provider: der Cloudanbieter
* the CLI: Das CLI
* the command line interface: Das Kommandozeileninterface
* the docs: die Dokumentation (use singular case)
* the default value: der Defaultwert
* NOT the default value: der Standardwert
* the default declaration: die Default-Deklaration
* the engine: die Engine
* the env var: die Umgebungsvariable
* the error response: die Error-Response
* the event: das Event
* the exception: die Exception
* the exception handler: der Exceptionhandler
* the form model: das Formularmodell
* the form body: der Formularbody
* the header: der Header
* the headers (plural case): die Header
* in headers (plural case): in Headern
* the lifespan event: das Lifespan-Event
* the locking: das Locking
* the mobile application: die Mobile-Anwendung
* the model object: das Modellobjekt
* the mounting: das Mounten
* mounted: gemountet
* the origin: das Origin
* the override: Die Überschreibung
* the parameter: der Parameter
* the parameters (plural case): die Parameter
* the function parameter: der Funktionsparameter
* the default parameter: der Defaultparameter
* the body parameter: der Body-Parameter
* the request body parameter: der Requestbody-Parameter
* the path parameter: der Pfad-Parameter
* the query parameter: der Query-Parameter
* the cookie parameter: der Cookie-Parameter
* the header parameter: der Header-Parameter
* the form parameter: der Formular-Parameter
* the payload: die Payload
* the query: die Query
* the recap: die Zusammenfassung
* the request: der Request
* the requestbody: der Requestbody
* the requestbodies (plural case): die Requestbodys
* the response: die Response
* the return type: der Rückgabetyp
* the return value: der Rückgabewert
* the SQLModel docs: die SQLModel-Dokumentation
* the SDK: das SDK
* the tag: der Tag
* the Tutorial - User guide: das Tutorial – Benutzerhandbuch
* the type annotation: die Typannotation
* the type hint: der Typhinweis
* the wildcard: die Wildcard
* the worker class: die Workerklasse
* NOT the worker class: die Arbeiterklasse
* the worker process: der Workerprozess
* NOT the worker process: der Arbeiterprozess
* to commit: committen
* to modify: ändern
* to serve (an application): bereitstellen
* to serve (a response): ausliefern
* NOT to serve: bedienen
* to upgrade: aktualisieren
* to wrap: wrappen
* `foo` as a `type`: `foo` vom Typ `type`
* `foo` as a `type`: `foo`, ein `type`
* FastAPI's X: FastAPIs X
* Starlette's Y: Starlettes Y
* X is case-sensitive: Groß-/Klein­schrei­bung ist relevant in X
* X is case-insensitive: Groß-/Klein­schrei­bung ist nicht relevant in X
* standard Python: Standard-Python
* deprecated: deprecatet
9) Preserve indentation. Keep emoticons. Encode in utf-8. Use Linux line breaks (LF)
Source (English):
«««
## Type hints and annotations { #type-hints-and-annotations }
»»»
Translate with (German) – use a short dash:
«««
## Typhinweise und -annotationen { #type-hints-and-annotations }
»»»
Do NOT translate with (German):
«««
## Typhinweise und –annotationen { #type-hints-and-annotations }
»»»
3.2) Do not apply rule 3 to the untranslated part of the heading inside curly brackets, which you shall not translate.
### German instructions, when to use and when not to use hyphens in words (written in first person, which is you)
In der Regel versuche ich so weit wie möglich Worte zusammenzuschreiben, also ohne Bindestrich, es sei denn, es ist Konkretesding-Klassevondingen, etwa «Pydantic-Modell» (aber: «Datenbankmodell»), «Python-Modul» (aber: «Standardmodul»). Ich setze auch einen Bindestrich, wenn er die gleichen Buchstaben verbindet, etwa «Enum-Member», «Cloud-Dienst», «Template-Engine». Oder wenn das Wort sonst einfach zu lang wird, etwa, «Performance-Optimierung». Oder um etwas visuell besser zu dokumentieren, etwa «Pfadoperation-Dekorator», «Pfadoperation-Funktion».
### German instructions about difficult to translate technical terms (written in first person, which is you)
Ich versuche nicht, alles einzudeutschen. Das bezieht sich besonders auf Begriffe aus dem Bereich der Programmierung. Ich wandele zwar korrekt in Großschreibung um und setze Bindestriche, wo notwendig, aber ansonsten lasse ich solch ein Wort unverändert. Beispielsweise wird aus dem englischen Wort «string» in der deutschen Übersetzung «String», aber nicht «Zeichenkette». Oder aus dem englischen Wort «request body» wird in der deutschen Übersetzung «Requestbody», aber nicht «Anfragekörper». Oder aus dem englischen «response» wird im Deutschen «Response», aber nicht «Antwort».
### List of English terms and their preferred German translations
Below is a list of English terms and their preferred German translations, separated by a colon («:»). Use these translations, do not use your own. If an existing translation does not use these terms, update it to use them. A term or a translation may be followed by an explanation in brackets, which explains when to translate the term this way. If a translation is preceded by «NOT», then that means: do NOT use this translation for this term. English nouns, starting with the word «the», have the German genus – «der», «die», «das» – prepended to their German translation, to help you to grammatically decline the translation. They are given in singular case, unless they have «(plural)» attached, which means they are given in plural case. Verbs are given in the full infinitive – starting with the word «to».
* «/// check»: «/// check | Testen»
* «/// danger»: «/// danger | Gefahr»
* «/// info»: «/// info | Info»
* «/// note | Technical Details»: «/// note | Technische Details»
* «/// note»: «/// note | Hinweis»
* «/// tip»: «/// tip | Tipp»
* «/// warning»: «/// warning | Achtung»
* «you»: «Sie»
* «your»: «Ihr»
* «e.g»: «z. B.»
* «etc.»: «usw.»
* «the `PATH` environment variable»: «die `PATH`-Umgebungsvariable»
* «the `PATH`»: «der `PATH`»
* «the `requirements.txt`»: «die `requirements.txt`»
* «the API Router»: «der API-Router»
* «the app»: «die App»
* «the application»: «die Anwendung»
* «the Advanced User Guide»: «das Handbuch für fortgeschrittene Benutzer»
* «the Authorization-Header»: «der Autorisierungsheader»
* «the `Authorization`-Header»: «der `Authorization`-Header»
* «the background task»: «der Hintergrundtask»
* «the cloud provider»: «der Cloudanbieter»
* «the CLI»: «Das CLI»
* «the command line interface»: «Das Kommandozeileninterface»
* «the docs»: «die Dokumentation» (use singular case)
* «the default value»: «der Defaultwert»
* «the default value»: NOT «der Standardwert»
* «the default declaration»: «die Default-Deklaration»
* «the engine»: «die Engine»
* «the env var»: «die Umgebungsvariable»
* «the error response»: «die Error-Response»
* «the event»: «das Event»
* «the exception»: «die Exception»
* «the exception handler»: «der Exceptionhandler»
* «the form model»: «das Formularmodell»
* «the form body»: «der Formularbody»
* «the header»: «der Header»
* «the headers» (plural): «die Header»
* «in headers» (plural): «in Headern»
* «the lifespan event»: «das Lifespan-Event»
* «the lock»: «der Lock»
* «the locking»: «das Locking»
* «the mobile application»: «die Mobile-Anwendung»
* «the model object»: «das Modellobjekt»
* «the mounting»: «das Mounten»
* «mounted»: «gemountet»
* «the origin»: «das Origin»
* «the override»: «Die Überschreibung»
* «the parameter»: «der Parameter»
* «the parameters» (plural): «die Parameter»
* «the function parameter»: «der Funktionsparameter»
* «the default parameter»: «der Defaultparameter»
* «the body parameter»: «der Body-Parameter»
* «the request body parameter»: «der Requestbody-Parameter»
* «the path parameter»: «der Pfad-Parameter»
* «the query parameter»: «der Query-Parameter»
* «the cookie parameter»: «der Cookie-Parameter»
* «the header parameter»: «der Header-Parameter»
* «the form parameter»: «der Formular-Parameter»
* «the payload»: «die Payload»
* «the query»: «die Query»
* «the recap»: «die Zusammenfassung»
* «the request»: «der Request»
* «the request body»: «der Requestbody»
* «the request bodies» (plural): «die Requestbodys»
* «the response»: «die Response»
* «the return type»: «der Rückgabetyp»
* «the return value»: «der Rückgabewert»
* «the SQLModel docs»: «die SQLModel-Dokumentation»
* «the SDK»: «das SDK»
* «the tag»: «der Tag»
* «the Tutorial - User guide»: «das Tutorial – Benutzerhandbuch»
* «the type annotation»: «die Typannotation»
* «the type hint»: «der Typhinweis»
* «the wildcard»: «die Wildcard»
* «the worker class»: «die Workerklasse»
* «the worker class»: NOT «die Arbeiterklasse»
* «the worker process»: «der Workerprozess»
* «the worker process»: NOT «der Arbeiterprozess»
* «to commit»: «committen»
* «to modify»: «ändern»
* «to serve» (an application): «bereitstellen»
* «to serve» (a response): «ausliefern»
* «to serve»: NOT «bedienen»
* «to upgrade»: «aktualisieren»
* «to wrap»: «wrappen»
* «`foo` as a `type`»: «`foo` vom Typ `type`»
* «`foo` as a `type`»: «`foo`, ein `type`»
* «FastAPI's X»: «FastAPIs X»
* «Starlette's Y»: «Starlettes Y»
* «X is case-sensitive»: «Groß-/Klein­schrei­bung ist relevant in X»
* «X is case-insensitive»: «Groß-/Klein­schrei­bung ist nicht relevant in X»
* «standard Python»: «Standard-Python»
* «deprecated»: «deprecatet»
### Other rules
Preserve indentation. Keep emoticons. Encode in utf-8. Use Linux line breaks (LF)

663
scripts/translate.py

@ -24,303 +24,618 @@ non_translated_sections = (
"contributing.md",
)
general_prompt = """
For technical terms in English that don't have a common translation term, use the original term in English.
### About literal text in this prompt
For code snippets or fragments, surrounded by backticks (`), don't translate the content, keep the original in English. For example, `list`, `dict`, keep them as is.
1) In the following instructions (after I say: `The above rules are in effect now`) the two characters `«` and `»` will be used to surround text and characters which you shall interpret literally. The `«` and the `»` are not part of the literal text (they are the meta characters denoting it).
The content is written in Markdown, write the translation in Markdown as well.
2) Furthermore, text surrounded by `«««` and `»»»` is a block of literal text which spans multiple lines. To get its content, dedent all lines of the block until the `«««` and `»»»` are at column zero, then remove the newline after the `«««` and the newline before the `»»»`. The `«««` and the `»»»` are not part of the literal text block (they are the meta characters denoting it).
3) The above two syntaxes `«...»` and `«««...»»»` are used to denote literal text. Other forms of quotation marks especially backticks and triple backticks do NOT denote literal text.
When there is a code block, surrounded by triple backticks, do not translate its content, except for comments in the language which the code block uses.
The above rules are relevant, because we will give code examples for Markdown. Markdown uses backticks to denote inline code and code blocks. So, if you see text surrounded by backticks, then do not interpret it as literal text and throw away the backticks, but interpret it as a Markdown code block or a Markdown code snippet, and keep the backticks.
Examples:
The above rules are in effect now.
Source (English) The code block is a bash code example with one comment:
```bash
# Print greeting
echo "Hello, World!"
```
Result (German):
```bash
# Gruß ausgeben
echo "Hello, World!"
```
Source (English) The code block is a console example containing HTML tags. No comments, nothing to change here:
```console
$ <font color="#4E9A06">fastapi</font> run <u style="text-decoration-style:solid">main.py</u>
<span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span> Starting server
Searching for package file structure
```
Result (German):
```console
$ <font color="#4E9A06">fastapi</font> run <u style="text-decoration-style:solid">main.py</u>
<span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span> Starting server
Searching for package file structure
```
Source (English) The code block is a console example containing 5 comments:
```console
// Go to the home directory
$ cd
// Create a directory for all your code projects
$ mkdir code
// Enter into that code directory
$ cd code
// Create a directory for this project
$ mkdir awesome-project
// Enter into that project directory
$ cd awesome-project
```
Result (German):
```console
// Gehe zum Home-Verzeichnis
$ cd
// Erstelle ein Verzeichnis für alle Ihre Code-Projekte
$ mkdir code
// Gehe in dieses Code-Verzeichnis
$ cd code
// Erstelle ein Verzeichnis für dieses Projekt
$ mkdir awesome-project
// Gehe in dieses Projektverzeichnis
$ cd awesome-project
```
If there is an existing translation and its Mermaid diagram is in sync with the Mermaid diagram in the English source, except a few translated words, then use the Mermaid diagram of the existing translation. The human editor of the translation translated these words in the Mermaid diagram. Keep these translations, do not revert them back to the English source.
### Definitions of terms used in this prompt
Example:
Backtick
The character «`»
Unicode U+0060 (GRAVE ACCENT)
Single backtick
A single backtick «`»
triple backticks
Three backticks in a row «```»
Neutral double quote
The character «"»
Unicode U+0022 (QUOTATION MARK)
Neutral single quote
The character «'»
Unicode U+0027 (APOSTROPHE)
English double typographic quotes
The characters «» and «»
Unicode U+201C (LEFT DOUBLE QUOTATION MARK) and Unicode U+201D (RIGHT DOUBLE QUOTATION MARK)
English single typographic quotes
The characters «» and «»
Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and Unicode U+2019 (RIGHT SINGLE QUOTATION MARK)
Code snippet
Text in a Markdown document which is surrounded by single backticks.
Examples:
«`foo`»
«`lorem ipsum`»
Code block
Text in a Markdown document which is surrounded by triple backticks. Spreads multiple lines.
Example:
«««
```
Hello
World
```
»»»
Example:
«««
```python
print("hello World")
```
»»»
### Your task
Translate an English text the original content to a target language.
The original content is written in Markdown, write the translation in Markdown as well.
The original content will be surrounded by triple percentage signs («%%%»). Do not include the triple percentage signs in the translation.
Source (English):
```mermaid
flowchart LR
subgraph global[global env]
harry-1[harry v1]
end
subgraph stone-project[philosophers-stone project]
stone(philosophers-stone) -->|requires| harry-1
end
```
### Technical terms in English
Existing translation (German) has three translations:
For technical terms in English that don't have a common translation term, use the original term in English.
### Content of code snippets
Do not translate the content of code snippets, keep the original in English. For example, «`list`», «`dict`», keep them as is.
### Content of code blocks
```mermaid
flowchart LR
subgraph global[globale Umgebung]
harry-1[harry v1]
end
subgraph stone-project[philosophers-stone-Projekt]
stone(philosophers-stone) -->|benötigt| harry-1
end
```
Do not translate the content of code blocks, except for comments in the language which the code block uses.
Result (German) you change nothing:
Examples:
```mermaid
flowchart LR
subgraph global[globale Umgebung]
harry-1[harry v1]
end
subgraph stone-project[philosophers-stone-Projekt]
stone(philosophers-stone) -->|benötigt| harry-1
end
```
Source (English) The code block is a bash code example with one comment:
«««
```bash
# Print greeting
echo "Hello, World!"
```
»»»
Result (German):
«««
```bash
# Gruß ausgeben
echo "Hello, World!"
```
»»»
Source (English) The code block is a console example containing HTML tags. No comments, so nothing to change here:
«««
```console
$ <font color="#4E9A06">fastapi</font> run <u style="text-decoration-style:solid">main.py</u>
<span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span> Starting server
Searching for package file structure
```
»»»
Result (German):
«««
```console
$ <font color="#4E9A06">fastapi</font> run <u style="text-decoration-style:solid">main.py</u>
<span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span> Starting server
Searching for package file structure
```
»»»
Source (English) The code block is a console example containing 5 comments:
«««
```console
// Go to the home directory
$ cd
// Create a directory for all your code projects
$ mkdir code
// Enter into that code directory
$ cd code
// Create a directory for this project
$ mkdir awesome-project
// Enter into that project directory
$ cd awesome-project
```
»»»
Result (German):
«««
```console
// Gehe zum Home-Verzeichnis
$ cd
// Erstelle ein Verzeichnis für alle Ihre Code-Projekte
$ mkdir code
// Gehe in dieses Code-Verzeichnis
$ cd code
// Erstelle ein Verzeichnis für dieses Projekt
$ mkdir awesome-project
// Gehe in dieses Projektverzeichnis
$ cd awesome-project
```
»»»
If there is an existing translation and its Mermaid diagram is in sync with the Mermaid diagram in the English source, except a few translated words, then use the Mermaid diagram of the existing translation. The human editor of the translation translated these words in the Mermaid diagram. Keep these translations, do not revert them back to the English source.
The original content will be surrounded by triple percentage signs (%) and you should translate it to the target language. Do not include the triple percentage signs in the translation.
Example:
Source (English):
«««
```mermaid
flowchart LR
subgraph global[global env]
harry-1[harry v1]
end
subgraph stone-project[philosophers-stone project]
stone(philosophers-stone) -->|requires| harry-1
end
```
»»»
Existing translation (German) has three translations:
«««
```mermaid
flowchart LR
subgraph global[globale Umgebung]
harry-1[harry v1]
end
subgraph stone-project[philosophers-stone-Projekt]
stone(philosophers-stone) -->|benötigt| harry-1
end
```
»»»
Result (German) you change nothing:
«««
```mermaid
flowchart LR
subgraph global[globale Umgebung]
harry-1[harry v1]
end
subgraph stone-project[philosophers-stone-Projekt]
stone(philosophers-stone) -->|benötigt| harry-1
end
```
»»»
### Special blocks
There are special blocks of notes, tips and others that look like:
/// note
«««
/// note
»»»
To translate it, keep the same line and add the translation after a vertical bar.
For example, if you were translating to Spanish, you would write:
/// note | Nota
«««
/// note | Nota
»»»
Some examples in Spanish:
Source:
Source:
/// tip
«««
/// tip
»»»
Result:
Result:
/// tip | Consejo
«««
/// tip | Consejo
»»»
Source:
Source:
/// details | Preview
«««
/// details | Preview
»»»
Result:
Result:
/// details | Vista previa
«««
/// details | Vista previa
»»»
There are special blocks surrounded by four slashes (`////`). They mark text, which will be rendered as part of a tab in the final document. The scheme is:
### Tab blocks
//// tab | {tab title}
{tab content, may span many lines}
////
There are special blocks surrounded by four slashes («////»). They mark text, which will be rendered as part of a tab in the final document. The scheme is:
Keep everything before the vertical bar (`|`) as is, including the vertical bar. Translate the tab title. Translate the tab content, applying the rules you know. Keep the four block closing slashes as is.
«««
//// tab | {tab title}
{tab content, may span many lines}
////
»»»
Keep everything before the vertical bar («|») as is, including the vertical bar. Translate the tab title. Translate the tab content, applying the rules you know. Keep the four block closing slashes as is.
Examples:
Source (English):
Source (English):
«««
//// tab | Python 3.8+ non-Annotated
Hello
////
»»»
//// tab | Python 3.8+ non-Annotated
Hello
////
Result (German):
Result (German):
«««
//// tab | Python 3.8+ nicht annotiert
Hallo
////
»»»
//// tab | Python 3.8+ nicht annotiert
Hallo
////
Source (English) Here there is nothing to translate in the tab title:
Source (English) Here there is nothing to translate in the tab title:
«««
//// tab | Linux, macOS, Windows Bash
Hello again
////
»»»
//// tab | Linux, macOS, Windows Bash
Hello again
////
Result (German):
Result (German):
«««
//// tab | Linux, macOS, Windows Bash
Hallo wieder
////
»»»
//// tab | Linux, macOS, Windows Bash
Hallo wieder
////
### Headings
Every Markdown heading in the English text (all levels) ends with a part inside curly brackets. This part denotes the hash of this heading, which is used in links to this heading. In translations, translate the heading, but do not translate this hash part, so that links do not break.
Examples of how to translate a heading:
Source (English):
Source (English):
«««
## Alternative API docs { #alternative-api-docs }
»»»
## Alternative API docs { #alternative-api-docs }
Result (Spanish):
Result (Spanish):
«««
## Documentación de la API alternativa { #alternative-api-docs }
»»»
## Documentación de la API alternativa { #alternative-api-docs }
Source (English):
Source (English):
«««
### Example { #example }
»»»
### Example { #example }
Result (German):
Result (German):
«««
### Beispiel { #example }
»»»
### Beispiel { #example }
### Links
Use the following rules for links (apply both to Markdown-style links ([text](url)) and to HTML-style <a> tags):
Use the following rules for links (apply both to Markdown-style links («[text](url)») and to HTML-style «<a>» tags):
1) For relative URLs only translate link text. Do not translate the URL or its parts
1) For relative URLs, only translate link text. Do not translate the URL or its parts
Example:
Source (English):
Source (English):
[One of the fastest Python frameworks available](#performance)
«««
[One of the fastest Python frameworks available](#performance)
»»»
Result (German):
Result (German):
[Eines der schnellsten verfügbaren Python-Frameworks](#performance)
«««
[Eines der schnellsten verfügbaren Python-Frameworks](#performance)
»»»
2) For absolute URLs which DO NOT start EXACTLY with "https://fastapi.tiangolo.com", only translate link text and leave the URL unchanged.
2) For absolute URLs which DO NOT start EXACTLY with «https://fastapi.tiangolo.com», only translate link text and leave the URL unchanged.
Example:
Source (English):
Source (English):
<a href="https://sqlmodel.tiangolo.com/" class="external-link" target="_blank">SQLModel docs</a>
«««
<a href="https://sqlmodel.tiangolo.com/" class="external-link" target="_blank">SQLModel docs</a>
»»»
Result (German):
Result (German):
<a href="https://sqlmodel.tiangolo.com/" class="external-link" target="_blank">SQLModel-Dokumentation</a>
«««
<a href="https://sqlmodel.tiangolo.com/" class="external-link" target="_blank">SQLModel-Dokumentation</a>
»»»
3) For absolute URLs which DO start EXACTLY with "https://fastapi.tiangolo.com", only translate link text and change the URL by adding language code (https://fastapi.tiangolo.com/{language_code}[rest part of the url]).
3) For absolute URLs which DO start EXACTLY with «https://fastapi.tiangolo.com», only translate link text and change the URL by adding language code («https://fastapi.tiangolo.com/{language_code}[rest part of the url]»).
Example:
Source (English):
Source (English):
<a href="https://fastapi.tiangolo.com/tutorial/path-params/#documentation" class="external-link" target="_blank">Documentation</a>
«««
<a href="https://fastapi.tiangolo.com/tutorial/path-params/#documentation" class="external-link" target="_blank">Documentation</a>
»»»
Result (Spanish):
Result (Spanish):
<a href="https://fastapi.tiangolo.com/es/tutorial/path-params/#documentation" class="external-link" target="_blank">Documentación</a>
«««
<a href="https://fastapi.tiangolo.com/es/tutorial/path-params/#documentation" class="external-link" target="_blank">Documentación</a>
»»»
3.1) Do not add language codes for URLs that point to static assets (e.g., images, CSS, JavaScript).
Example:
Source (English):
Source (English):
<a href="https://fastapi.tiangolo.com/img/something.jpg" class="external-link" target="_blank">Something</a>
«««
<a href="https://fastapi.tiangolo.com/img/something.jpg" class="external-link" target="_blank">Something</a>
»»»
Result (Spanish):
Result (Spanish):
<a href="https://fastapi.tiangolo.com/img/something.jpg" class="external-link" target="_blank">Algo</a>
«««
<a href="https://fastapi.tiangolo.com/img/something.jpg" class="external-link" target="_blank">Algo</a>
»»»
4) For internal links, only translate link text.
Example:
Source (English):
Source (English):
[Create Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}
«««
[Create Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}
»»»
Result (German):
Result (German):
[Pull Requests erzeugen](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}
«««
[Pull Requests erzeugen](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}
»»»
5) Do not translate anchor fragments in links (the part after #), as they must remain the same to work correctly.
5) Do not translate anchor fragments in links (the part after «#»), as they must remain the same to work correctly.
5.1) If an existing translation has a link with an anchor fragment different to the anchor fragment in the English source, then this is an error. Fix this by using the anchor fragment of the English source.
Example:
Source (English):
Source (English):
[Body - Multiple Parameters: Singular values in body](body-multiple-params.md#singular-values-in-body){.internal-link target=_blank}
«««
[Body - Multiple Parameters: Singular values in body](body-multiple-params.md#singular-values-in-body){.internal-link target=_blank}
»»»
Existing wrong translation (German) notice the wrongly translated anchor fragment:
Existing wrong translation (German) notice the wrongly translated anchor fragment:
[Body Mehrere Parameter: Einfache Werte im Body](body-multiple-params.md#einzelne-werte-im-body){.internal-link target=_blank}.
«««
[Body Mehrere Parameter: Einfache Werte im Body](body-multiple-params.md#einzelne-werte-im-body){.internal-link target=_blank}.
»»»
Result (German) you fix the anchor fragment:
Result (German) you fix the anchor fragment:
[Body Mehrere Parameter: Einfache Werte im Body](body-multiple-params.md#singular-values-in-body){.internal-link target=_blank}.
«««
[Body Mehrere Parameter: Einfache Werte im Body](body-multiple-params.md#singular-values-in-body){.internal-link target=_blank}.
»»»
5.2) Do not add anchor fragments at will, even if this makes sense. If the English source has no anchor, don't add one.
Example:
Source (English):
Source (English):
«««
Create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}
»»»
Wrong translation (German) Anchor added to the URL.
«««
Erstelle eine [virtuelle Umgebung](../virtual-environments.md#create-a-virtual-environment){.internal-link target=_blank}
»»»
Good translation (German) URL stays like in the English source.
«««
Erstelle eine [Virtuelle Umgebung](../virtual-environments.md){.internal-link target=_blank}
»»»
### Abbr elements
Translate HTML abbr elements as follows:
1) If the title attribute gives the full phrase for an abbreviation, then keep the phrase, append a dash («»), followed by the translation of the phrase.
Examples:
Source (English):
«««
<abbr title="Internet of Things">IoT</abbr>
<abbr title="Central Processing Unit">CPU</abbr>
<abbr title="too long; didn't read"><strong>TL;DR:</strong></abbr>
»»»
Result (German):
«««
<abbr title="Internet of Things – Internet der Dinge">IoT</abbr>
<abbr title="Central Processing Unit – Zentrale Verarbeitungseinheit">CPU</abbr>
<abbr title="too long; didn't read – zu lang; hab's nicht gelesen"><strong>TL;DR:</strong></abbr>
»»»
Conversion scheme title attribute:
Source (English):
{full phrase}
Result (German):
{full phrase} {translation of full phrase}
1.1) If the translation of the phrase starts with the same letters, then just use the translation.
Examples:
Source (English):
«««
<abbr title="JSON Web Tokens">JWT</abbr>
<abbr title="Enumeration">`Enum`</abbr>
<abbr title="Asynchronous Server Gateway Interface">ASGI</abbr>
»»»
Result (German):
«««
<abbr title="JSON Web Tokens">JWT</abbr>
<abbr title="Enumeration">`Enum`</abbr>
<abbr title="Asynchrones Server-Gateway-Interface">ASGI</abbr>
»»»
Conversion scheme title attribute:
Source (English):
{full phrase}
Result (German):
{translation of full phrase}
2) If the title attribute explains something in its own words, then translate it, if possible.
Examples:
Source (English):
«««
<abbr title="also known as: endpoints, routes">path</abbr>
<abbr title="A program that checks for code errors">linter</abbr>
<abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>
<abbr title="before 2023-03">0.95.0</abbr>
<abbr title="2023-08-26">at the time of writing this</abbr>
»»»
Result (German):
«««
<abbr title="auch bekannt als: Endpunkte, Routen">Pfad</abbr>
<abbr title="Programm das auf Fehler im Code prüft">Linter</abbr>
<abbr title="Konvertieren des Strings eines HTTP-Requests in Python-Daten">Parsen</abbr>
<abbr title="vor 2023-03">0.95.0</abbr>
<abbr title="2023-08-26">zum Zeitpunkt als das hier geschrieben wurde</abbr>
»»»
Conversion scheme title attribute:
Source (English):
{explanation}
Result (German):
{translation of explanation}
3) If the title attribute gives the full phrase for an abbreviation, followed by a colon («:») or a comma («,»), followed by an explanation, then keep the phrase, append a dash («»), followed by the translation of the phrase, followed by a colon («:»), followed by the translation of the explanation.
Examples:
Source (English):
«««
<abbr title="Input/Output: disk reading or writing, network communication.">I/O</abbr>
<abbr title="Content Delivery Network: Service, that provides static files.">CDN</abbr>
<abbr title="Integrated Development Environment, similar to a code editor">IDE</abbr>
<abbr title="Object Relational Mapper, a fancy term for a library where some classes represent SQL tables and instances represent rows in those tables">"ORMs"</abbr>
»»»
Result (German):
«««
<abbr title="Input/Output – Eingabe/Ausgabe: Lesen oder Schreiben auf der Festplatte, Netzwerkkommunikation.">I/O</abbr>
<abbr title="Content Delivery Network – Inhalte auslieferndes Netzwerk: Dienst, der statische Dateien bereitstellt.">CDN</abbr>
<abbr title="Integrated Development Environment – Integrierte Entwicklungsumgebung: Ähnlich einem Code-Editor">IDE</abbr>
<abbr title="Object Relational Mapper – Objektrelationaler Mapper: Ein Fachbegriff für eine Bibliothek, in der einige Klassen SQL-Tabellen und Instanzen Zeilen in diesen Tabellen darstellen">ORMs</abbr>
»»»
Conversion scheme title attribute:
Source (English):
{full phrase}: {explanation}
OR
Source (English):
{full phrase}, {explanation}
Result (German):
{full phrase} {translation of full phrase}: {translation of explanation}
Create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}
3.1) For the full phrase (the part before the dash in the translation) rule 1.1 also applies, speak, you can leave the original full phrase away and just use the translated full phrase, if it starts with the same letters. The result becomes:
Wrong translation (German) Anchor added to the URL.
Conversion scheme title attribute:
Erstelle eine [virtuelle Umgebung](../virtual-environments.md#create-a-virtual-environment){.internal-link target=_blank}
Result (German):
Good translation (German) URL stays like in the English source.
{translation of full phrase}: {translation of explanation}
Erstelle eine [Virtuelle Umgebung](../virtual-environments.md){.internal-link target=_blank}
4) If there is an HTML abbr element in a sentence in an existing translation, but that element does not exist in the related sentence in the English text, then keep that HTML abbr element in the translation, do not change or remove it. Except when you remove the whole sentence from the translation, because the whole sentence was removed from the English text. The reasoning for this rule is, that such abbr elements are manually added by the human editor of the translation, in order to translate or explain an English word to the human readers of the translation. They would not make sense in the English text, but they do make sense in the translation. So keep them in the translation, even though they are not part of the English text. This rule only applies to HTML abbr elements.
"""

Loading…
Cancel
Save