Skip to content

Commit 65b3aa4

Browse files
committed
docs: Update localization examples to use pt-PT and new content.
1 parent aad1c22 commit 65b3aa4

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/caching-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The caching infrastructure is automatically wired up by Aspire.
3939

4040
### Usage Pattern
4141

42-
Instead of `GetOrCreateAsync`, use `GetOrCreateLocalizedAsync`. This method automatically appends the current UI culture (e.g., `|en-US`, `|pt-BR`) to the cache key.
42+
Instead of `GetOrCreateAsync`, use `GetOrCreateLocalizedAsync`. This method automatically appends the current UI culture (e.g., `|pt-PT`, `|pt-BR`) to the cache key.
4343

4444
```csharp
4545
public class BookService(HybridCache cache)

docs/localization-guide.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This approach ensures high performance by eliminating complex runtime fallback l
1818

1919
### Supported Languages
2020

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`).
2222

2323
**Standard Configuration (Generic)**:
2424
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
3232
```
3333

3434
**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.).
3636
```json
3737
{
3838
"Localization": {
@@ -72,19 +72,19 @@ Translations are captured at the source in Domain Events using a dictionary.
7272
You can store both generic and specific keys.
7373
```json
7474
{
75-
"pt": "Programação",
76-
"pt-BR": "Programação (Brasil)",
77-
"en": "Programming"
75+
"pt": "Desporto",
76+
"pt-BR": "Esporte",
77+
"en": "Sports"
7878
}
7979
```
8080

8181
## Fallback Strategy (Write-Time)
8282

8383
The API applies fallback logic **during projection generation** to ensure every supported culture has content.
8484

85-
**Logic sequence for a target culture (e.g., `pt-BR`):**
85+
**Logic sequence for a target culture (e.g., `pt-PT`):**
8686

87-
1. **Exact Match**: Look for a translation with key `"pt-BR"`.
87+
1. **Exact Match**: Look for a translation with key `"pt-PT"`.
8888
2. **Parent Culture**: Look for a translation with key `"pt"`.
8989
3. **Default Culture**: Look for a translation with the key of the `DefaultCulture`.
9090
4. **Any**: Use the first available translation.
@@ -100,7 +100,7 @@ Clients request a specific language using the `Accept-Language` header.
100100

101101
```http
102102
GET /api/books HTTP/1.1
103-
Accept-Language: pt-BR
103+
Accept-Language: pt-PT
104104
```
105105

106106
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
110110
Endpoints are simplified to purely read operations. They resolve the current culture (handled by ASP.NET Core middleware) and query the corresponding database tenant.
111111

112112
```csharp
113-
// 1. Resolve culture (e.g., "pt-BR")
113+
// 1. Resolve culture (e.g., "pt-PT")
114114
var culture = CultureInfo.CurrentCulture.Name;
115115

116116
// 2. Open a session specific to that culture

0 commit comments

Comments
 (0)