Ability to manually specify locale in SSR
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 14 giờ 23 phút
- Pull request đã merge (30 ngày)
- 162
Mô tả
### Description
There is no way to specify locale in [`AngularAppEngine#handle`](https://github.com/angular/angular-cli/blob/19.0.0/packages/angular/ssr/src/app-engine.ts#L65-L69) based on [`Accept-Language`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language), [`Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie), etc. The current implementation of [`AngularAppEngine`](https://github.com/angular/angular-cli/blob/19.0.0/packages/angular/ssr/src/app-engine.ts#L24) chooses locale based on URL.
### Describe the solution you'd like
Ability to specify an array of locales when calling `handle`:
```diff
app.use('/**', (req, res, next) => {
angularApp
- .handle(req)
+ .handle(req, undefined, { locales: req.acceptsLanguages() })
.then((response) =>
response ? writeResponseToNodeResponse(response, res) : next(),
)
```
As far as I understand, this will also require removing the locale prefix from ``.
### Describe alternatives you've considered
_No response_
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với packages/angular/ssr/src/app-engine.ts, đặc biệt là AngularAppEngine#handle và cơ chế chọn locale hiện tại dựa trên URL. Theo dõi cách locale đi đến tài liệu được kết xuất, sau đó xác minh rằng các bên gọi có thể cung cấp một mảng locale có thứ tự từ dữ liệu request và rằng thu được không giữ lại tiền tố locale không mong muốn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- backend, internationalization
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100