Skip to content

Conversation

@softins
Copy link
Member

@softins softins commented Nov 6, 2025

Short description of changes

This converts the Perl script tools/checkkeys.pl from using the deprecated XML::Simple to using XML::LibXML instead. There are no changes in functionality or behaviour.

CHANGELOG: Tools: update checkkeys.pl to use XML::LibXML

Context: Fixes an issue?

XML::Simple is now deprecated as reported by @pljones on Discord. This is the only tool in the repo that used XML::Simple.

Does this change need documentation? What needs to be documented and how?

No. Internal operation only.

Status of this Pull Request

Ready to merge

What is missing until this pull request can be merged?

Nothing

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

#next MESSAGE if $type eq 'unfinished'; # don't skip unfinished strings, as they may still get used

push @{$keys{en}{$contextname}{uc $1}}, $message->{source} unless $doneeng;
# skip messages without an accelerator key
Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, we're still skipping even if the translation has an accelerator but the English doesn't.

Shouldn't we

  1. Check that both English and translation have accelerators or both don't (for documentation consistency) -- or is this done elsewhere?
  2. Then skip if both don't

If the "both the same" is done elsewhere, this is okay -- but I'd suggest mentioning that in the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, we're still skipping even if the translation has an accelerator but the English doesn't.

I'll check, but I think that's the same with the existing tool.

Shouldn't we

  1. Check that both English and translation have accelerators or both don't (for documentation consistency) -- or is this done elsewhere?
  1. Then skip if both don't

That is probably a good idea, but out of scope for this PR, which was only concerned with changing XML library.

If the "both the same" is done elsewhere, this is okay -- but I'd suggest mentioning that in the comment.

There are other improvements that could be done to this tool too, but I would do them, and the good suggestions above, separately. At the moment, the output of the tool is just a starting point to aid manual review as part of the release process.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, it does change the flow, which raises the questions over what the old was doing and what the new is doing.

@pljones pljones added this to Tracking Nov 7, 2025
@github-project-automation github-project-automation bot moved this to Triage in Tracking Nov 7, 2025
@pljones pljones moved this from Triage to In Progress in Tracking Nov 7, 2025
@pljones pljones added the refactoring Non-behavioural changes, Code cleanup label Nov 7, 2025
@pljones pljones added this to the Release 3.12.0 milestone Nov 7, 2025
@pljones
Copy link
Collaborator

pljones commented Nov 7, 2025

Ran on HEAD of softins/jamulus:perl-xml-libxml

$ ./tools/checkkeys.pl

Possible duplicate hotkeys:

I'm pretty certain that's right!


Not for now but I'll feature request a summary saying "Checked files, found languages with hotkeys" then only emit the "Possible duplicate hotkeys:" if there are any. (Of course, it's so long since I wrote any Perl, I'm tempted to use AI to translate it to something else -- bash with yq (which'll do XML) or even python -- and change that...)

@softins
Copy link
Member Author

softins commented Nov 7, 2025

Ran on HEAD of softins/jamulus:perl-xml-libxml

$ ./tools/checkkeys.pl

Possible duplicate hotkeys:

I'm pretty certain that's right!

You need to cd to the translation directory first:

cd src/translations
../../tools/checkkeys.pl

The new version of the tool produces identical output to the old one. The output is simplistic in that it isn't able to take full account of context to know which accelerators actually conflict, and which matches are actually ok because they are in different menus, for example. But overcoming that is a bigger project than just changing XML library.

Not for now but I'll feature request a summary saying "Checked files, found languages with hotkeys" then only emit the "Possible duplicate hotkeys:" if there are any. (Of course, it's so long since I wrote any Perl, I'm tempted to use AI to translate it to something else -- bash with yq (which'll do XML) or even python -- and change that...)

If rewriting it, it would need to be into Python with nested dicts. But I'm only a beginner with Python, as opposed to being very at home with Perl for 30 years!

@pljones
Copy link
Collaborator

pljones commented Nov 8, 2025

You need to cd to the translation directory first:

Things like that could also be changed. Ideally all these checks should be run from the repository root and take care of their own internal requirements. Again, not for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Non-behavioural changes, Code cleanup

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants