-
Notifications
You must be signed in to change notification settings - Fork 528
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
Pretranslation breaks for accesskey labels with variant keys of type NumberLiteral #3461
Comments
This might be the relevant part of the log (Firefox sync happened at 8:02 on Nov 28)
|
For Android, I think the problem is an integrity_error
|
Found the Raygun exception in my... Spam. This is the string in question: The error is reproducible. See the snippet below. The code that extracts access key candidates expects that if the source attribute is a from pontoon.base.models import *
from pontoon.pretranslation.pretranslate import get_pretranslations
entity = Entity.objects.get(pk=313552)
locale = Locale.objects.get(code="sv-SE")
get_pretranslations(entity, locale, False)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/app/pontoon/pretranslation/pretranslate.py", line 56, in get_pretranslations
pretranslate.visit(entry)
File "/app/.heroku/python/lib/python3.11/site-packages/fluent/syntax/visitor.py", line 47, in visit
return visit(node)
^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/fluent/syntax/visitor.py", line 54, in generic_visit
new_val = self.visit(child)
^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/fluent/syntax/visitor.py", line 47, in visit
return visit(node)
^^^^^^^^^^^
File "/app/pontoon/pretranslation/transformer.py", line 205, in visit_Attribute
if set_accesskey(element):
^^^^^^^^^^^^^^^^^^^^^^
File "/app/pontoon/pretranslation/transformer.py", line 194, in set_accesskey
candidates = extract_accesskey_candidates(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/pontoon/pretranslation/transformer.py", line 129, in extract_accesskey_candidates
source = get_source(["label", "value", "aria-label"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/pontoon/pretranslation/transformer.py", line 109, in get_source
variant = next(
^^^^^
File "/app/pontoon/pretranslation/transformer.py", line 110, in <genexpr>
(v for v in variants if v.key.name == variant_name), variants[0]
^^^^^^^^^^
AttributeError: 'NumberLiteral' object has no attribute 'name' |
@andy-moz mentioned that pretranslation didn't run automatically for Swedish in a few occasions (notably, new strings for Firefox and Firefox for Android this week).
Firefox had 6 translations missing, and manually pretranslation worked for them. Trying to see if I can spot anything in the logs.
Pretranslation worked as expected for me, earlier this week (Italian, Mozilla accounts).
The text was updated successfully, but these errors were encountered: