Skip to content

Finishes TeX Error localisation#1479

Open
zorkow wants to merge 8 commits into
feature/localefrom
feature/locale_finish_tex
Open

Finishes TeX Error localisation#1479
zorkow wants to merge 8 commits into
feature/localefrom
feature/locale_finish_tex

Conversation

@zorkow
Copy link
Copy Markdown
Member

@zorkow zorkow commented May 19, 2026

PR (nearly) finished the localisation of the tex module. In particular, it

  • removes all duplicates from the extension packages
  • puts all error messages into the right place
  • errors in BaseItem and subclasses now get the Component string and id.
  • introduces a texError function that throws the localised TexError. This way we do not have a breaking change. texError gets type never, which is needed to avoid typescript errors, but which makes it a bit awkward to test.

Finally, the only point still to be discusses is how to deal with the getPackage errors, in particular since there is also a warning. Should we make the Error a TexError and localise the warning?

Note, that I have added copy blocks to all the necessary config.json files in the components. Once PR #1476 hits develop I will merge that in and resolve the conflicts.

@zorkow zorkow requested a review from dpvc May 19, 2026 12:11
Copy link
Copy Markdown
Member

@dpvc dpvc left a comment

Choose a reason for hiding this comment

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

This all looks good, with one recommended change.

Comment thread ts/util/Locale.ts
Comment on lines 136 to 138
let message = '';
if (component) {
message = this.lookupMessage(component, id);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since message is only used in the if (component) block, line 136 can be removed and line 138 can be made const message = ....

@dpvc
Copy link
Copy Markdown
Member

dpvc commented May 19, 2026

Looks like this needs to have pnpm -s format:fix run on it.

Comment on lines +45 to +49
/**
* @override
*/
protected component = COMPONENT;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this still needed? I don't see where it is used.

@dpvc
Copy link
Copy Markdown
Member

dpvc commented May 20, 2026

Does this line

throw Error('Unknown tags class');

need to be localized?

And also this one?

console.log('TexParser Warning: ' + message);

The first can be done through Locale.error(). Should there also be a Locale function for the second? Like Locale.log()? (Or should Locale.error() use console.error() and a new function Locale.throw() use throw?)

@dpvc
Copy link
Copy Markdown
Member

dpvc commented May 20, 2026

Here are a couple more:

throw Error(
'The bussproofs extension requires an output jax with a getBBox() method'
);

throw Error('Illegal characters used in \\require prefix');

throw Error(`Package '${name}' doesn't target the proper parser`);

Copy link
Copy Markdown
Member

@dpvc dpvc left a comment

Choose a reason for hiding this comment

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

There are problems with the jsdoc comments, here.

Comment thread ts/util/Locale.ts
Comment on lines +152 to +155
* @param {string | namedData = {}} data The first argument or the object of
* names arguments
* @param {string[]} ...args Additional arguments (if data is a string)
* @param {...any} args
Copy link
Copy Markdown
Member

@dpvc dpvc May 20, 2026

Choose a reason for hiding this comment

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

The JSDoc comments are messed up, here. The = {} in the data argument should be removed, as should the ... in line 154. Line 155 should be removed entirely.

Suggested change
* @param {string | namedData = {}} data The first argument or the object of
* names arguments
* @param {string[]} ...args Additional arguments (if data is a string)
* @param {...any} args
* @param {string|namedData} data The first argument or the object of named arguments
* @param {string[]} args Additional arguments (if data is a string)

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.

2 participants