You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/localization-guide.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ This approach ensures high performance by eliminating complex runtime fallback l
18
18
19
19
### Supported Languages
20
20
21
-
The API is configured using **ISO 639-1 language codes**. You can configure either generic codes (e.g., `en`, `pt`) or specific regional cultures (e.g., `en-US`, `pt-BR`).
21
+
The API is configured using **ISO 639-1 language codes**. You can configure either generic codes (e.g., `en`, `pt`) or specific regional cultures (e.g., `en-US`, `pt-PT`).
22
22
23
23
**Standard Configuration (Generic)**:
24
24
Suitable for applications where a single translation per language works for all regions.
@@ -32,7 +32,7 @@ Suitable for applications where a single translation per language works for all
32
32
```
33
33
34
34
**Regional Configuration (Specific)**:
35
-
Suitable when you need different content for specific regions (e.g., "Color" vs "Colour").
35
+
Suitable when you need different content for specific regions (e.g., "Color" vs "Colour" in English, or regional differences between pt-PT, pt-BR, etc.).
36
36
```json
37
37
{
38
38
"Localization": {
@@ -72,19 +72,19 @@ Translations are captured at the source in Domain Events using a dictionary.
72
72
You can store both generic and specific keys.
73
73
```json
74
74
{
75
-
"pt": "Programação",
76
-
"pt-BR": "Programação (Brasil)",
77
-
"en": "Programming"
75
+
"pt": "Desporto",
76
+
"pt-BR": "Esporte",
77
+
"en": "Sports"
78
78
}
79
79
```
80
80
81
81
## Fallback Strategy (Write-Time)
82
82
83
83
The API applies fallback logic **during projection generation** to ensure every supported culture has content.
84
84
85
-
**Logic sequence for a target culture (e.g., `pt-BR`):**
85
+
**Logic sequence for a target culture (e.g., `pt-PT`):**
86
86
87
-
1.**Exact Match**: Look for a translation with key `"pt-BR"`.
87
+
1.**Exact Match**: Look for a translation with key `"pt-PT"`.
88
88
2.**Parent Culture**: Look for a translation with key `"pt"`.
89
89
3.**Default Culture**: Look for a translation with the key of the `DefaultCulture`.
90
90
4.**Any**: Use the first available translation.
@@ -100,7 +100,7 @@ Clients request a specific language using the `Accept-Language` header.
100
100
101
101
```http
102
102
GET /api/books HTTP/1.1
103
-
Accept-Language: pt-BR
103
+
Accept-Language: pt-PT
104
104
```
105
105
106
106
If the requested culture is not supported (e.g., `ja-JP`), the API will automatically fall back to the configured `DefaultCulture`.
@@ -110,7 +110,7 @@ If the requested culture is not supported (e.g., `ja-JP`), the API will automati
110
110
Endpoints are simplified to purely read operations. They resolve the current culture (handled by ASP.NET Core middleware) and query the corresponding database tenant.
0 commit comments