Fix alert normalization - #91
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d224db7d91
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const issues = title.match(/^.+?\s+issues?\b\s*[::]?\s*(.+)$/i); | ||
| return issues?.[1] ? WeatherAlerts.#NormalizeTranslatedEnglishAlertTitle(issues[1]) : WeatherAlerts.#TrimWeatherAlertTitle(structuredTitle || title); |
There was a problem hiding this comment.
Preserve non-English localized alert headlines
For QWeather requests using supported languages other than Chinese or English (for example ja, or passthrough locales such as de), localized headlines generally contain neither 发布 nor issues/issued. This fallback therefore selects the nonempty phenomenon instead of title, discarding the full localized headline and qualifiers such as the warning level; both WeatherAlerts.Build and mergeAlerts now expose only the generic event type. Fall back to the original title when no recognized issuer grammar matched, using phenomenon only when the title is empty.
Useful? React with 👍 / 👎.
Fixes #90