symbols: support group references in replacements#11116
Conversation
|
Hi, this is more towards changes for developers, although it would be beneficial to talk about it briefly as part of the user guide if warranted. Thanks.
|
Do you mean that I shouldn't have submitted the pull request here, but rather to another repository? |
|
Hi, no, my comment relates to changes entry. Thanks.
|
|
I added some words in the ./devDocs/developerGuide.t2t |
Ah, ok, I reworded it |
Maybe https://github.com/nvaccess/nvda/wiki/Github-pull-request-template-explanation-and-examples#change-log-entry should say it explicitly that the text should be meant for users? |
|
Hi Samuel :) |
|
Heya André :) |
|
@josephsl can you comment on whether it will cause problems for the current translation system if changes are accepted to languages other than English? |
|
Hi, as translations come from SVN and are done by individual translators, it would be best to push to English symbols file, which will then pass onto translators as a diff later. Thanks,
|
|
Here there are no english changes, just fixes in a couple of translations, and an improvement in another one. |
|
To make things simpler, I have now dropped the locale/ changes, and we can commit the locale/ fixes separately |
|
Will this also fix issue #2676? |
|
So, any comment on including this? I would like to include the same support in speech-dispatcher which uses the same dict files, but I would rather avoid making the file format diverge... |
|
Hello, any comment on this? |
feerrenrut
left a comment
There was a problem hiding this comment.
Thanks for the contribution @sthibaul and apologies for the delay to review the work.
See test results for failed build of commit c28540f6ab |
See test results for failed build of commit d39809229c |
See test results for failed build of commit 36cd65d3f6 |
9b6c2e3 to
0b833e6
Compare
See test results for failed build of commit 5fdd52145c |
…merge Also drop the test for now, will be commited after mergin the translator update.
|
Ok, we have sorted out the french translation question. Michel has commited reverting to not using groups, and using norep instead of always. In this pull request I have dropped the fr_FR test, so that it can be commited without waiting for the french translation update. When this pull request is merged, Michel will be able to update the french translation to use the group support, and then I'll submit another pull request to add a test for it. |
See test results for failed build of commit ddc8590040 |
|
I did not review the code. However I have some remarks:
|
Please read the latest version of the pull request, not the initial version. The initial version was using just what was actually in fr/symbols.dic, which happened to be doing exactly that, that's why I had initially just used it as such. That's one of the clarification points we had with Michel. The latest version of the pull request takes as example to replace the dots with "point".
That's exactly what is currently in the pull request (but with norep, not always, which would introduce odd effects, that was also part of the clarification points with Michel)
No it was not, there was no "point" word there. Against that's part of what Michel fixed.
Yes, and this is the whole point of this feature: avoid having to use a complex double-case rule, and instead have just one simple rule, with exactly the same effect as before (and the "expected effect" in the french translation was unclear, Michel now cleared up, to appear in git).
As you wish, these parts are up to translator to see what they prefer, I just took what was already there. |
Ah, sorry, rereading it I see what you mean: since the effect of the rule is on the whole date and not on the dot, we should rename the name and comment of the rule accordingly. I have now done so. |
|
Also two other thoughts:
|
I'm not sure to understand: that dialog box contains the Pattern and the Replacement next to each other, is there really a need to make people document how the group replacement works? If they were written separately, I would agree that the interface needs to be documented somewhere, but from what I understand Pattern and Replacement are written together?
Right, I have added some text. |
The symbol dialog box contains only the rules. For simple symbols, it actually contains the pattern and the replacement next to each other on each line. But for complex symbols, you only have the name of the complex symbol (e.g.
Seems you made the addition in the wrong paragraph, i.e. the paragraph about dictionaries instead of the paragraph about symbol dialog. |
Ah, that's why I was confused in how it would work. The user would indeed need to be notified somehow which group corresponds to what. I have added an initial paragraph, but rule comments would have to specify it indeed |
|
Any news on this? @feerrenrut perhaps? The french translation question has been sorted out, we will update it after this gets commited. |
|
Ok, thanks @sthibaul so I can take it that this is no longer blocked by the French translation and is ready for review and merging? |
That's it, yes! |
Link to issue number:
fixes #11107
Summary of the issue:
Rules such as
dates .are quite complex to write:((?<=\b\d\d)\.(?=\d\d.(\d{2}|\d{4})\b))|((?<=\b\d\d.\d\d)\.(?=(\d{2}|\d{4})\b))because one wants to change two pieces of text here, and so we have to match them twice. Other rules are even more complex to write (e.g.1,20€->1 euro 20needs two complex symbols to perform the two differing,->euro€->`` replacements.Description of how this pull request fixes the issue:
This adds support for regexp group references.
Testing performed:
I tested the use of it in the French translation, included in the commit:
The change uses Python's standard support for group, already used for the complex group parsing.
Known issues with pull request:
It requires checking that no symbols file includes a backslash in the replacement string. I did this, and found two (commented) occurrences in the italian symbols file, fixed by the commit. (and incidently found a typo in the hebrew file)
Change log entry:
New features
Symbol pronunciation: Support grouping in complex symbol definition and group references in replacement rule, making them more powerful and simpler. (#11107)