i18n Message improvements
During the Oslo meeting on 2013-10-11 (http://
Blueprint information
- Status:
- Complete
- Approver:
- Doug Hellmann
- Priority:
- High
- Drafter:
- Luis A. Garcia
- Direction:
- Approved
- Assignee:
- Luis A. Garcia
- Definition:
- Discussion
- Series goal:
- Accepted for icehouse
- Implementation:
-
Implemented
- Milestone target:
-
2014.1
- Started by
- Doug Hellmann
- Completed by
- Luis A. Garcia
Related branches
Sprints
Whiteboard
Changes that need to happen:
- Add a translate() method to Messages to use instead of str() or unicode()
- translation to system locale done via translate(None)
- update log.py:
- str() and unicode() should raise RuntimeErrors to enforce proper usage (translate())
- and return and error message pointing users to use translate()
- OpenStack projects should be changed to expect Message objects from _() and handle accordingly
- catch any Messages and resolve to unicode (using translate()) before they exit any OpenStack code
- Implement __repr__ for implicit printing cases i.e. print _("hello world") where _() returns non-ascii encodable utf8 bytes
- support .format() on Messages for now to handle _('Something {0}").format(
- translate() needs to support having a Message instance passed as an arg to __mod__ or .format()
- We should NOT support:
- both __add__ and __radd__ since it implies using translated strings in "improper" ways
- similarly, __mul__
Related etherpad link: https:/
Some background on the original thinking behind https:/
This is a very simple example of what happens if you disable the __str__ method: http://
Gerrit topic: https:/
Addressed by: https:/
Translation Message improvements
Retargeting to i-2 because I think there is still some discussion to be held about the implementation. - dhellmann
Addressed by: https:/
Allow the Message class to have non-English default locales
Addressed by: https:/
Enable setting up translation handler via CONF
Addressed by: https:/
Add support for locales missing from babel
Addressed by: https:/
Return the unicode representation of an object
Work Items
Dependency tree

* Blueprints in grey have been implemented.