Commit a8b20f6e authored by Jérome Perrin's avatar Jérome Perrin Committed by Rafael Monnerat

bts: translation mapping should be utf-8 encoded strings

parent 00827d81
...@@ -28,11 +28,11 @@ reversal = accounting_module.newContent ( ...@@ -28,11 +28,11 @@ reversal = accounting_module.newContent (
destination_payment_request=context.getProperty('destination_payment_request'), destination_payment_request=context.getProperty('destination_payment_request'),
source_administration=context.getSourceAdministration(), source_administration=context.getSourceAdministration(),
destination_administration=context.getDestinationAdministration(), destination_administration=context.getDestinationAdministration(),
title = Base_translateString("Reversal Transaction for ${title}", title=Base_translateString("Reversal Transaction for ${title}",
mapping={'title':unicode(context.getTitleOrId(), 'utf8')}), mapping={'title': context.getTitleOrId()}),
description = Base_translateString( description=Base_translateString(
"Reversal Transaction for ${title} (${specific_reference})", "Reversal Transaction for ${title} (${specific_reference})",
mapping={'title': unicode(context.getTitleOrId(), 'utf8'), mapping={'title': context.getTitleOrId(),
'specific_reference': specific_reference}), 'specific_reference': specific_reference}),
resource=context.getResource(), resource=context.getResource(),
specialise_list=context.getSpecialiseList(), specialise_list=context.getSpecialiseList(),
......
...@@ -42,10 +42,9 @@ if sum(total_payable_price_details.values()) == 0: ...@@ -42,10 +42,9 @@ if sum(total_payable_price_details.values()) == 0:
related_payment = portal.accounting_module.newContent( related_payment = portal.accounting_module.newContent(
portal_type=transaction_portal_type, portal_type=transaction_portal_type,
title=str(Base_translateString("Payment of ${invoice_title}", title=Base_translateString("Payment of ${invoice_title}",
mapping=dict(invoice_title=unicode((context.getReference() or mapping=dict(invoice_title=(context.getReference() or
context.getTitle() or ''), context.getTitle() or ''))),
'utf8', 'repr')))),
source_section=context.getSourceSection(), source_section=context.getSourceSection(),
destination_section=context.getDestinationSection(), destination_section=context.getDestinationSection(),
source_project=context.getSourceProject(), source_project=context.getSourceProject(),
......
...@@ -34,22 +34,19 @@ for line in transaction_lines: ...@@ -34,22 +34,19 @@ for line in transaction_lines:
if account is not None and account.getValidationState() != 'validated': if account is not None and account.getValidationState() != 'validated':
raise ValidationFailed, translateString( raise ValidationFailed, translateString(
"Account ${account_title} is not validated.", "Account ${account_title} is not validated.",
mapping=dict(account_title=unicode( mapping=dict(account_title=account.Account_getFormattedTitle()))
account.Account_getFormattedTitle(), 'utf8')))
if third_party is not None and\ if third_party is not None and\
third_party.getValidationState() in invalid_state_list: third_party.getValidationState() in invalid_state_list:
raise ValidationFailed, translateString( raise ValidationFailed, translateString(
"Third party ${third_party_name} is invalid.", "Third party ${third_party_name} is invalid.",
mapping=dict(third_party_name=unicode( mapping=dict(third_party_name=third_party.getTitle()))
third_party.getTitle(), 'utf8')))
if bank_account is not None: if bank_account is not None:
if bank_account.getValidationState() in invalid_state_list: if bank_account.getValidationState() in invalid_state_list:
raise ValidationFailed, translateString( raise ValidationFailed, translateString(
"Bank Account ${bank_account_reference} is invalid.", "Bank Account ${bank_account_reference} is invalid.",
mapping=dict(bank_account_reference=unicode( mapping=dict(bank_account_reference=bank_account.getReference()))
bank_account.getReference(), 'utf8')))
if account is not None and account.isMemberOf('account_type/asset/cash/bank'): if account is not None and account.isMemberOf('account_type/asset/cash/bank'):
# also check that currencies are consistent if we use this quantity for # also check that currencies are consistent if we use this quantity for
...@@ -60,8 +57,8 @@ for line in transaction_lines: ...@@ -60,8 +57,8 @@ for line in transaction_lines:
raise ValidationFailed, translateString( raise ValidationFailed, translateString(
"Bank Account ${bank_account_reference} " "Bank Account ${bank_account_reference} "
"uses ${bank_account_currency} as default currency.", "uses ${bank_account_currency} as default currency.",
mapping=dict(bank_account_reference=unicode(bank_account.getReference(), 'utf8'), mapping=dict(bank_account_reference=bank_account.getReference(),
bank_account_currency=unicode(bank_account.getPriceCurrencyReference(), 'utf8'))) bank_account_currency=bank_account.getPriceCurrencyReference()))
source_currency = None source_currency = None
source_section = line.getSourceSectionValue() source_section = line.getSourceSectionValue()
......
...@@ -17,10 +17,10 @@ if packing_list_list: ...@@ -17,10 +17,10 @@ if packing_list_list:
# first, try to get a full translated message with portal types # first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()), "%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation # if not found, fallback to generic translation
default = unicode(translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.', default=translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(), mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(), "that_portal_type": context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8')) "that_title": context.getTitleOrId() }))
return related_order_list[0].Base_redirect('view', return related_order_list[0].Base_redirect('view',
keep_items=dict(portal_status_message=message)) keep_items=dict(portal_status_message=message))
else: else:
......
...@@ -18,10 +18,10 @@ if packing_list_list: ...@@ -18,10 +18,10 @@ if packing_list_list:
# first, try to get a full translated message with portal types # first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()), "%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation # if not found, fallback to generic translation
default = unicode(translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.', default=translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(), mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(), "that_portal_type": context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8')) "that_title": context.getTitleOrId() }))
return related_object.Base_redirect('view', return related_object.Base_redirect('view',
keep_items=dict(portal_status_message=message)) keep_items=dict(portal_status_message=message))
else: else:
......
...@@ -13,13 +13,13 @@ for line in context.getMovementList( ...@@ -13,13 +13,13 @@ for line in context.getMovementList(
# first, try to get a full translated message with portal types # first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()), "%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation # if not found, fallback to generic translation
default = unicode(translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.', default=translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(), mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(), "that_portal_type": context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8')))) "that_title": context.getTitleOrId()}))))
return context.Base_redirect('view', keep_items=dict( return context.Base_redirect('view', keep_items=dict(
portal_status_message=translateString( portal_status_message=translateString(
'No %s Related' % portal_type, 'No %s Related' % portal_type,
default = unicode(translateString('No ${portal_type} related.', default=translateString('No ${portal_type} related.',
mapping = { 'portal_type': translateString(portal_type)}), 'utf8')))) mapping={'portal_type': translateString(portal_type)}))))
...@@ -42,8 +42,8 @@ if len(related_list) == 0: ...@@ -42,8 +42,8 @@ if len(related_list) == 0:
url = context.absolute_url() url = context.absolute_url()
message = Base_translateString( message = Base_translateString(
'No %s Related' % portal_type[0], 'No %s Related' % portal_type[0],
default = unicode(Base_translateString('No ${portal_type} related.', default=Base_translateString('No ${portal_type} related.',
mapping = { 'portal_type': Base_translateString(portal_type[0])}), 'utf8')) mapping={'portal_type': Base_translateString(portal_type[0])}))
elif len(related_list) == 1: elif len(related_list) == 1:
relation_found = 1 relation_found = 1
...@@ -63,10 +63,10 @@ elif len(related_list) == 1: ...@@ -63,10 +63,10 @@ elif len(related_list) == 1:
# first, try to get a full translated message with portal types # first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()), "%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation # if not found, fallback to generic translation
default = unicode(Base_translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.', default=Base_translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(), mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(), "that_portal_type": context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8')) "that_title": context.getTitleOrId() }),)
else : else :
url = context.absolute_url() url = context.absolute_url()
message = Base_translateString("You are not authorised to view the related document.") message = Base_translateString("You are not authorised to view the related document.")
......
  • For reference: This is !459 (merged) that was applied with rebase instead of merge.

    ( the reasons for these changes are described in the merge request )

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment