Controversies in translation for log and exception.

Bug #1910526 reported by Mitya Eremeev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.i18n
New
Undecided
Unassigned

Bug Description

This bug tracker is for errors with the documentation, use the following as a template and remove or add fields as you see fit. Convert [ ] into [x] to check boxes:

- [x] This doc is inaccurate in this way:
there are controversies regarding translating a string for logging and exception:
1. we translate a string and put it in log and exception
# Log and Raise
    msg = _('Unexpected error message')
    LOG.exception(msg)
    raise RuntimeError(msg)
https://docs.openstack.org/oslo.i18n/latest/user/usage.html

2. we put one not translated string in log and another translated string in exception
For example, do not do this:

# WRONG
msg = _('There was an error.')
LOG.error(msg)
raise LocalExceptionClass(msg)
or this:

# EVEN MORE WRONG
msg = _LE('There was an error.')
LOG.error(msg)
raise LocalExceptionClass(msg)
Instead, use this style:

# RIGHT
LOG.error('There was an error.')
raise LocalExceptionClass(_('An error occurred.'))
https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html

- [ ] This is a doc addition request.
- [ ] I have a fix to the document that I can paste below including example: input and output.

If you have a troubleshooting or support issue, use the following resources:

 - The mailing list: https://lists.openstack.org
 - IRC: 'openstack' channel on Freenode

-----------------------------------
Release: 5.1.0.dev6 on 2018-09-12 22:18:36
SHA: 8609dc2c4ceacd2b5b3acb34430de29838a219fa
Source: https://opendev.org/openstack/oslo.i18n/src/doc/source/user/usage.rst
URL: https://docs.openstack.org/oslo.i18n/latest/user/usage.html

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.