-
Notifications
You must be signed in to change notification settings - Fork 166
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
translations: Add more validation, fix many formatting errors #620
translations: Add more validation, fix many formatting errors #620
Conversation
Fixes TypeError when numbers are optional in eg. singular forms. See python/cpython#52606
This makes sure that Weblate properly validates the placeholders.
@deltragon You are referring to someone adding translation directly via git, bypassing weblate, right? Also, do you know if the translation you fixed will be automatically sent to weblate? I don't want weblate to automatically overwrite the broken translation you had fixed |
I tested that it works. I could not test whether the translations work properly without runtime errors (as my computer's language is English), but I trust your skills. I approve merging. |
You mean |
Thanks, corrected the typo. |
No, I mean when someone adds a new translatable string in python or glade. In #569, this was done without adding the strings to the .pot/.po files - with this, they would know what to run to make sure the strings are translatable.
Yes, they will be - or rather, Weblate will complain about a conflict, if there is one, that can be resolved manually. I have access to pull the changes into Weblate and resolve the conflict if needed.
Thanks! This is ready from my side. |
I guess now we need to push from GitHub to Weblate. |
Fixes #618.
Partially addresses #608.
This PR strongly expands
validate_po.py
, which now checks the following:There were multiple such cases, including:
%
instead of%s
,d%
instead of%d
in RTL languages)%(translated_name)s
instead of%(name)s
)This is not a runtime error on its own - however, many languages translate singular forms with words ("one hour") instead of numbers ("1 hour"). When using unnamed placeholders, this leads to a runtime error again.
This means that translations can reorder the sentence as needed.
.pot
) file contains all translatable strings.Additionally, this PR
#, python-format
annotation to strings with placeholders, so Weblate can also validate thempython validate_po.py --extract
) - which also adds/preserves the annotation stringsOnce this PR is merged, we need to document the new
python validate_po.py --extract
helper in our contributing guidelines, so if someone adds a new translation they will know to run the tool.