Skip to content

feat: aiPromptテンプレート変数に {{Lang}} (ブラウザ言語) を追加#357

Merged
ujiro99 merged 7 commits intomainfrom
copilot/add-user-language-to-aiprompt
Apr 8, 2026
Merged

feat: aiPromptテンプレート変数に {{Lang}} (ブラウザ言語) を追加#357
ujiro99 merged 7 commits intomainfrom
copilot/add-user-language-to-aiprompt

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

  • INSERTenumにLANGを追加し、InsertSymbolに対応するシンボル"Lang"を追加
  • dispatcher.tsbackgroundDispatcher.tsの変数マップにgetUILanguage()でユーザー言語を追加
  • helper.tsの変換関数にINSERT.LANGを追加
  • InputPopup.tsxのInputMenuに言語変数の挿入メニュー項目を追加
  • 全ロケールファイル(14言語)にPageAction_InputMenu_mark_langPageAction_InputMenu_langキーを追加
  • Option_aiPrompt_prompt_descの変数説明にユーザー言語を追記
  • backgroundDispatcher.test.tsにBDI-14・BDI-15テスト追加({{Lang}}変数の検証)
  • dispatcher.test.tsを新規作成(PDC-01〜03、PDI-01〜11: 計14テスト)
  • ja/messages.jsonPageAction_InputMenu_mark_langメッセージを「ブラウザの言語コードが挿入されます。(例:en, es, zh_CN)」に修正
  • ja/messages.jsonPageAction_InputMenu_langラベルを「ブラウザ言語コード」に修正

Copilot AI linked an issue Apr 2, 2026 that may be closed by this pull request
1 task
Copilot AI changed the title [WIP] Add user language as variable to aiPrompt feat: aiPromptテンプレート変数に {{Lang}} (ブラウザ言語) を追加 Apr 2, 2026
Copilot AI requested a review from ujiro99 April 2, 2026 23:02
@ujiro99
Copy link
Copy Markdown
Owner

ujiro99 commented Apr 3, 2026

@copilot
以下のついて、ユニットテストの追加をお願いします。

  • packages/extension/src/services/pageAction/backgroundDispatcher.test.ts
  • packages/extension/src/services/pageAction/dispatcher.ts

なお、dispatcher.ts については既存のユニットテストが無いため、新規に作成してください。

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot
以下のついて、ユニットテストの追加をお願いします。

  • packages/extension/src/services/pageAction/backgroundDispatcher.test.ts
    ...

コミット 8f11d72 でテストを追加しました。

backgroundDispatcher.test.ts(既存ファイルへの追加):

  • BDI-14: {{lang}} 変数がvariableマップに含まれることを検証
  • BDI-15: {{lang}} を含む複数変数の同時展開を検証

dispatcher.test.ts(新規作成):

  • PDC-01〜03: click アクションの基本動作・エラー処理・XPath対応
  • PDI-01〜11: input アクションの全変数置換テスト({{lang}}{{selectedText}}{{url}}{{clipboard}}・ユーザー変数含む)

合計 16 テストを追加、全 745 テストがパスしています。

Copilot AI requested a review from ujiro99 April 3, 2026 03:34
"message": "クリップボードから挿入されます"
},
"PageAction_InputMenu_mark_lang": {
"message": "ブラウザの言語が挿入されます",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 言語というとEnglish、などが期待されますが実際に入力されるのは言語コードです。実態に合わせて、messageを以下のように修正してください。

ブラウザの言語コードが挿入されます。(例:en, es, zh_CN)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コミット 1f68bc5 で修正しました。PageAction_InputMenu_mark_lang のメッセージを「ブラウザの言語コードが挿入されます。(例:en, es, zh_CN)」に変更しました。

"message": "クリップボード"
},
"PageAction_InputMenu_lang": {
"message": "ブラウザ言語"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot ここも、ブラウザ言語コード、としてください。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コミット 1f68bc5 で修正しました。PageAction_InputMenu_lang のラベルを「ブラウザ言語コード」に変更しました。

Copilot AI requested a review from ujiro99 April 7, 2026 22:54
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 31.57895% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.94%. Comparing base (f8ef5b8) to head (b2ce251).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...extension/src/components/pageAction/InputPopup.tsx 0.00% 4 Missing ⚠️
packages/extension/src/components/ui/form.tsx 0.00% 4 Missing ⚠️
...n/src/components/option/editor/AiPromptSection.tsx 0.00% 3 Missing ⚠️
...ckages/extension/src/services/pageAction/helper.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #357      +/-   ##
==========================================
+ Coverage   25.64%   25.94%   +0.30%     
==========================================
  Files         309      309              
  Lines       31295    31313      +18     
  Branches     1551     1579      +28     
==========================================
+ Hits         8026     8125      +99     
+ Misses      23269    23188      -81     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ujiro99 ujiro99 marked this pull request as ready for review April 8, 2026 04:10
@ujiro99 ujiro99 merged commit 2ec1054 into main Apr 8, 2026
6 checks passed
@ujiro99 ujiro99 deleted the copilot/add-user-language-to-aiprompt branch April 8, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aiPromptの変数としてユーザー言語を追加

2 participants