From 6b453ac9e2cb8a90dcc55fdc5fe387d55bc01ef1 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 26 Jun 2014 12:16:29 -0700 Subject: [PATCH] Clean up the i18n-enablement spec - Fix some rst formatting issues for lists. - Fix some links for review references. - Add a note to the Developer Impact section. Change-Id: I5ef706c40c43a6de4240c597023b498161c3209c --- specs/juno/i18n-enablement.rst | 38 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/specs/juno/i18n-enablement.rst b/specs/juno/i18n-enablement.rst index dfa20afd2..d101db013 100644 --- a/specs/juno/i18n-enablement.rst +++ b/specs/juno/i18n-enablement.rst @@ -59,17 +59,18 @@ nova/cmd/__init__.py. A few prepratory patches will be required due to the limitations of the i18n support: + * The Message class does not support str(), so use of str() on translatable -messages must be removed. The most common case being when it is used on an -exception that is being put into another translatable message or logged. -This is due to the requirement by logging in Python 2.6 that str() return -a UnicodeError. + messages must be removed. The most common case being when it is used on an + exception that is being put into another translatable message or logged. + This is due to the requirement by logging in Python 2.6 that str() return + a UnicodeError. * The Message class does not support concatenation of translatable messages, -so concatenation of translatable messages must be replaced with formatting. -This is due to the complexity caused by trying to concatenate two -independent Message instances potentially with overlapping replacement keys. -There are very few of these and the use of formatting allows for better -translation by translators. + so concatenation of translatable messages must be replaced with formatting. + This is due to the complexity caused by trying to concatenate two + independent Message instances potentially with overlapping replacement keys. + There are very few of these and the use of formatting allows for better + translation by translators. Alternatives ------------ @@ -121,6 +122,11 @@ Developer impact The developer impacts have already been in place for some time. Developers have been using _() around messages that need translation. +Note, however, that with the relatively new policy of not translating debug +log messages, concatenating strings and exceptions will need care since the +strings have to be cast to unicode. See https://review.openstack.org/#/c/78095/ +for examples. Cleaning this up is listed in the Work Items section. + Implementation ============== @@ -131,12 +137,11 @@ Assignee(s) Primary assignee: -Other contributors: - Work Items ---------- I am planning to implement this as three patches in this order: + * Remove concatenations of translatable messages * Remove use of str() on translatable messages * Add enable_lazy to nova/cmd/__init__.py @@ -146,8 +151,9 @@ Dependencies ============ None. + * Note that gettextutil was synced with the latest oslo-incubator via -commit 185e4562df47a101cf41d1e66d75de2644c78022. + commit 185e4562df47a101cf41d1e66d75de2644c78022. Testing @@ -159,11 +165,9 @@ Testing * Hacking checks will be investigated and added for failures caused when enabling lazy translation. - * For example the changes in - https://review.openstack.org/#/q/status:abandoned+project:openstack/ - nova+branch:master+topic:bp/i18n--messages,n,z> - which includes using str() (or six.text_type) on an exception used - as replacement text. + * For example the changes in https://review.openstack.org/#/c/78095/ and + https://review.openstack.org/#/c/78096/ which includes using str() + (or six.text_type) on an exception used as replacement text. Documentation Impact