Files
worldmonitor/todos/052-pending-p2-framework-settings-strings-not-i18n.md
Elie Habib 110ab402c4 feat(intelligence): analytical framework selector for AI panels (#2380)
* feat(frameworks): add settings section and import modal

- Add Analysis Frameworks group to preferences-content.ts between Intelligence and Media sections
- Per-panel active framework display (read-only, 4 panels)
- Skill library list with built-in badge, Rename and Delete actions for imported frameworks
- Import modal with two tabs: From agentskills.io (fetch + preview) and Paste JSON
- All error cases handled inline: network, domain validation, missing instructions, invalid JSON, duplicate name, instructions too long, rate limit
- Add api/skills/fetch-agentskills.ts edge function (proxy to agentskills.io)
- Add analysis-framework-store.ts (loadFrameworkLibrary, saveImportedFramework, deleteImportedFramework, renameImportedFramework, getActiveFrameworkForPanel)
- Add fw-* CSS classes to main.css matching dark panel aesthetic

* feat(panels): wire analytical framework store into InsightsPanel, CountryDeepDive, DailyMarketBrief, DeductionPanel

- InsightsPanel: append active framework to geoContext in updateFromClient(); subscribe in constructor, unsubscribe in destroy()
- CountryIntelManager: pass framework as query param to fetchCountryIntelBrief(); subscribe to re-open brief on framework change; unsubscribe in destroy()
- DataLoaderManager: add dailyBriefGeneration counter for stale-result guard; pass frameworkAppend to buildDailyMarketBrief(); subscribe to framework changes to force refresh; unsubscribe in destroy()
- daily-market-brief service: add frameworkAppend? field to BuildDailyMarketBriefOptions; append to extendedContext before summarize call
- DeductionPanel: append active framework to geoContext in handleSubmit() before RPC call

* feat(frameworks): add FrameworkSelector UI component

- Create FrameworkSelector component with premium/locked states
- Premium: select dropdown with all framework options, change triggers setActiveFrameworkForPanel
- Locked: disabled select + PRO badge, click calls showGatedCta(FREE_TIER)
- InsightsPanel: adds asterisk note (client-generated analysis hint)
- Wire into InsightsPanel, DailyMarketBriefPanel, DeductionPanel (via this.header)
- Wire into CountryDeepDivePanel header right-side (no Panel base, panel=null)
- Add framework-selector CSS to main.css

* fix(frameworks): make new proto fields optional in generated types

* fix(frameworks): extract firstMsg to satisfy strict null checks in tsconfig.api.json

* fix(docs): add blank lines around lists/headings to pass markdownlint

* fix(frameworks): add required proto string fields to call sites after make generate

* chore(review): add code review todos 041-057 for PR #2380

7 review agents (TypeScript, Security, Architecture, Performance,
Simplicity, Agent-Native, Learnings) identified 17 findings across
5 P1, 8 P2, and 4 P3 categories.
2026-03-27 23:36:44 +04:00

52 lines
2.2 KiB
Markdown

---
status: pending
priority: p2
issue_id: "052"
tags: [code-review, quality, i18n, analytical-frameworks]
dependencies: []
---
# Analysis Frameworks settings section uses hardcoded English — inconsistent with i18n pattern
## Problem Statement
The "Analysis Frameworks" section added to `preferences-content.ts` uses hardcoded English strings (`'Analysis Frameworks'`, `'Active per panel'`, `'Skill library'`, button labels, error messages, modal text). Every other section in `preferences-content.ts` uses `t('preferences.xxx')` for internationalization. The frameworks section is the only section that cannot be translated and will display in English even on French-locale (`fr`) builds.
## Findings
- **`src/services/preferences-content.ts`** — frameworks section: `html += \`<summary>Analysis Frameworks</summary>\`` and similar hardcoded strings
- All other sections: `t('preferences.aiProviders')`, `t('preferences.theme')`, etc.
- French locale (`fr`) is a supported language for the app
- Flagged by: code-simplicity-reviewer
## Proposed Solutions
### Option A: Add i18n keys and use `t()` (Recommended)
Add keys to both `en` and `fr` translation files:
```json
// en
"preferences": {
"analysisFrameworks": "Analysis Frameworks",
"activePerPanel": "Active per panel",
"skillLibrary": "Skill library",
...
}
```
Then use `t('preferences.analysisFrameworks')` in `preferences-content.ts`.
**Pros:** Consistent with existing pattern | **Effort:** Small | **Risk:** Low
### Option B: Accept as-is for now, file separate i18n ticket
Defer i18n to a follow-up PR since the frameworks feature is new and translations take time.
**Cons:** Creates a known inconsistency; French users see English UI | **Risk:** Low
## Technical Details
- File: `src/services/preferences-content.ts`
- PR: koala73/worldmonitor#2380
- Pattern to follow: existing `t('preferences.*')` calls throughout the same file
## Acceptance Criteria
- [ ] All user-visible strings in the Analysis Frameworks section use `t()` calls
- [ ] French translation keys exist for all new strings
- [ ] No hardcoded English strings remain in the frameworks section
## Work Log
- 2026-03-27: Identified during PR #2380 review by code-simplicity-reviewer