Skip to content

Add i18n support for math block error messages#73643

Merged
t-hamano merged 2 commits intoWordPress:trunkfrom
Utsav-Ladani:i18n/math-block-error-message
Nov 28, 2025
Merged

Add i18n support for math block error messages#73643
t-hamano merged 2 commits intoWordPress:trunkfrom
Utsav-Ladani:i18n/math-block-error-message

Conversation

@Utsav-Ladani
Copy link
Copy Markdown
Contributor

What?

Closes #73615

Include a localized prefix Error: before error messages in math blocks.

Why?

When parsing mathematical expressions fails in a Math block or Math format, the error message comes from the Temml library and lacks localization. Adding a localized Error: prefix clearly indicates to users that it's an error message.

How?

Implement by prepending a localized Error: prefix to the existing error message.

Testing Instructions

  1. Add a Math Block or Format in block editor.
  2. Put any invalid mathematical expression like &x^2
  3. Error message should start with Error: and it should be localized.

Screenshots

Before After
Screenshot 2025-11-28 at 3 18 08 PM Screenshot 2025-11-28 at 3 17 14 PM
Screenshot 2025-11-28 at 3 18 50 PM Screenshot 2025-11-28 at 3 19 46 PM

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 28, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Utsav-Ladani <utsavladani@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended Internationalization (i18n) Issues or PRs related to internationalization efforts labels Nov 28, 2025
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

@Utsav-Ladani Thanks for the PR!

@ellatrix @jasmussen, unfortunately, the message when parsing a formula fails cannot be localized. What do you think about this PR that adds a localizable prefix text instead?

@ellatrix
Copy link
Copy Markdown
Member

We're past string freeze, would this be fine? Are there any strings we can reuse, like "Error:" from somewhere else?

@t-hamano
Copy link
Copy Markdown
Contributor

We're past string freeze, would this be fine?

This is an improvement for 7.0, and I don't think it needs to be backported to 6.9.

@ellatrix
Copy link
Copy Markdown
Member

Sounds good to land then 🙂

@t-hamano t-hamano merged commit bfeec6d into WordPress:trunk Nov 28, 2025
40 checks passed
@github-actions github-actions bot added this to the Gutenberg 22.3 milestone Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Math block and format: Error messages are not localized

3 participants