angular / angular/angular-cli

Ability to manually specify locale in SSR

オープン
#29,019 コメント 6 件 リアクション 5 件 担当者 0 名 GitHub で見る
area: @angular/ssr feature feature: insufficient votes
主要言語
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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。