New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Remove blank strings" add-on removes only some strings in WebExtension JSON #9524
Comments
Does it remove more in consequent runs, or the other strings are never removed? |
Hey @nijel! It removes more in consequent runs. I just added a new translation and from the remaining strings half of them were removed. So, as I assume you were trying to confirm, there might be a bug iterating the translations which makes it skip a translation for each iteration in which it removes a string. I don't have much experience with Python and its technical intricacies, but maybe removing translations messes up with the iterator here and thus some elements are skipped: weblate/weblate/addons/base.py Lines 353 to 357 in 25fc7df
Here are the 2 commits which have appeared in my last test (after I manually committed the changes from the "Repository maintenance" page): First commitcommit 8cb5863e9090b6484c41c4c0d6069bb7502bfcec
Author: Adrià <CENSORED_EMAIL>
Date: Mon Jul 10 16:18:01 2023 +0000
Weblate: Update German (de) localization
Currently translated at 1.3% (2 of 143 strings)
Translation: TW Power Tools/Extension strings (JSON format)
Translate-URL: https://i18n.avm99963.com/projects/tw-power-tools/extension-strings-json-format/de/
Change-Id: Ib7aea7070b1cd003a7410f75b58e93594a2cb15c
diff --git a/src/static/_locales/de/messages.json b/src/static/_locales/de/messages.json
index 68f3373..3f7cc07 100644
--- a/src/static/_locales/de/messages.json
+++ b/src/static/_locales/de/messages.json
@@ -4,7 +4,7 @@
"description": "The extension's name"
},
"appNameCanary": {
- "message": "",
+ "message": "Test 2",
"description": "The extension's name for the beta version"
},
"appDescription": { Second commitcommit ab9d2d5ad1e3a67f9fffe13c4304d9c7e37f773e (weblate/master)
Author: Weblate bot <weblate-bot@avm99963.com>
Date: Mon Jul 10 16:18:26 2023 +0000
Update translation files
Updated by "Remove blank strings" hook in Weblate.
Translation: TW Power Tools/Extension strings (JSON format)
Translate-URL: https://i18n.avm99963.com/projects/tw-power-tools/extension-strings-json-format/
Change-Id: Ia1af2a162beecc31139d79c2719a760ec9ed2b0a
diff --git src/static/_locales/de/messages.json src/static/_locales/de/messages.json
index 3f7cc07..5e7caf5 100644
--- src/static/_locales/de/messages.json
+++ src/static/_locales/de/messages.json
@@ -1,300 +1,150 @@
{
"appName": {
"message": "Test",
"description": "The extension's name"
},
"appNameCanary": {
"message": "Test 2",
"description": "The extension's name for the beta version"
},
- "appDescription": {
- "message": "",
- "description": "The extension's description"
- },
"options_killswitchenabled": {
"message": "",
"description": "Warning shown in the options page below an option, when it has been remotely force disabled via the kill switch mechanism."
},
- "options_optionalpermissionswarning_label": {
- "message": "",
- "description": "Warning shown in the options page below an option, when a feature needs more permissions to work."
- },
"options_minorenhancements": {
"message": "",
"description": "Heading for several options that can be enabled in the options page."
},
- "options_thread": {
- "message": "",
- "description": "Feature checkbox in the options page"
- },
"options_fixedtoolbar": {
"message": "",
[...] |
The translation iteration you link is iterating over component languages, so that is definitely not the root cause here. But this code has the issue of iterating over a list that is being changed: weblate/weblate/formats/base.py Lines 729 to 751 in 563b2d9
|
Thank you for your report; the issue you have reported has just been fixed.
|
Awesome, thank you so much @nijel :)) |
Describe the issue
When enabling the "Remove blank strings" add-on in a component with WebExtension JSON format, only half of the empty strings are removed.
I already tried
Steps to reproduce the behavior
Expected behavior
I would expect the last commit to remove all strings except the only one I translated.
Instead, only half of the strings are removed by the add-on, as can be seen in the following sample commit (produced after following the reproduction steps):
Screenshots
N/A
Exception traceback
How do you run Weblate?
Docker container
Weblate versions
Weblate deploy checks
Additional context
No response
The text was updated successfully, but these errors were encountered: