mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 14:09:28 -02:30
Mark job_explanation strings after they are read from the db
- For strings that need to be translated, but are saved in the db: * They must be marked for translation using gettext_noop() to be translated. * And must also be marked for translation with _() when read from db and shown to the user. * [Ref]: https://docs.djangoproject.com/en/3.0/topics/i18n/translation/#marking-strings-as-no-op
This commit is contained in:
@@ -806,7 +806,9 @@ class UnifiedJobSerializer(BaseSerializer):
|
||||
td = now() - obj.started
|
||||
ret['elapsed'] = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / (10 ** 6 * 1.0)
|
||||
ret['elapsed'] = float(ret['elapsed'])
|
||||
|
||||
# Because this string is saved in the db in the source language,
|
||||
# it must be marked for translation after it is pulled from the db, not when set
|
||||
ret['job_explanation'] = _(obj.job_explanation)
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user