Ability to manually specify locale in SSR
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 14時間 23分
- マージ済み PR(30日)
- 162
説明
### 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_
コントリビューションガイド
調査の方向性
packages/angular/ssr/src/app-engine.ts から始め、特に AngularAppEngine#handle と現在の URL ベースの locale 選択を確認してください。locale がどのようにレンダリングされたドキュメントに到達するかを追跡し、そのうえで、呼び出し元がリクエストデータから順序付きの locale 配列を提供できること、また結果として得られる に不要な locale プレフィックスが残らないことを検証してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- backend, internationalization
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100