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 (
destination_payment_request=context.getProperty('destination_payment_request'),
source_administration=context.getSourceAdministration(),
destination_administration=context.getDestinationAdministration(),
title = Base_translateString("Reversal Transaction for ${title}",
mapping={'title':unicode(context.getTitleOrId(), 'utf8')}),
description = Base_translateString(
title=Base_translateString("Reversal Transaction for ${title}",
mapping={'title': context.getTitleOrId()}),
description=Base_translateString(
"Reversal Transaction for ${title} (${specific_reference})",
mapping={'title': unicode(context.getTitleOrId(), 'utf8'),
mapping={'title': context.getTitleOrId(),
'specific_reference': specific_reference}),
resource=context.getResource(),
specialise_list=context.getSpecialiseList(),
......
......@@ -42,10 +42,9 @@ if sum(total_payable_price_details.values()) == 0:
related_payment = portal.accounting_module.newContent(
portal_type=transaction_portal_type,
title=str(Base_translateString("Payment of ${invoice_title}",
mapping=dict(invoice_title=unicode((context.getReference() or
context.getTitle() or ''),
'utf8', 'repr')))),
title=Base_translateString("Payment of ${invoice_title}",
mapping=dict(invoice_title=(context.getReference() or
context.getTitle() or ''))),
source_section=context.getSourceSection(),
destination_section=context.getDestinationSection(),
source_project=context.getSourceProject(),
......
......@@ -34,22 +34,19 @@ for line in transaction_lines:
if account is not None and account.getValidationState() != 'validated':
raise ValidationFailed, translateString(
"Account ${account_title} is not validated.",
mapping=dict(account_title=unicode(
account.Account_getFormattedTitle(), 'utf8')))
mapping=dict(account_title=account.Account_getFormattedTitle()))
if third_party is not None and\
third_party.getValidationState() in invalid_state_list:
raise ValidationFailed, translateString(
"Third party ${third_party_name} is invalid.",
mapping=dict(third_party_name=unicode(
third_party.getTitle(), 'utf8')))
mapping=dict(third_party_name=third_party.getTitle()))
if bank_account is not None:
if bank_account.getValidationState() in invalid_state_list:
raise ValidationFailed, translateString(
"Bank Account ${bank_account_reference} is invalid.",
mapping=dict(bank_account_reference=unicode(
bank_account.getReference(), 'utf8')))
mapping=dict(bank_account_reference=bank_account.getReference()))
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
......@@ -60,8 +57,8 @@ for line in transaction_lines:
raise ValidationFailed, translateString(
"Bank Account ${bank_account_reference} "
"uses ${bank_account_currency} as default currency.",
mapping=dict(bank_account_reference=unicode(bank_account.getReference(), 'utf8'),
bank_account_currency=unicode(bank_account.getPriceCurrencyReference(), 'utf8')))
mapping=dict(bank_account_reference=bank_account.getReference(),
bank_account_currency=bank_account.getPriceCurrencyReference()))
source_currency = None
source_section = line.getSourceSectionValue()
......
......@@ -17,10 +17,10 @@ if packing_list_list:
# first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation
default = unicode(translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8'))
default=translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }))
return related_order_list[0].Base_redirect('view',
keep_items=dict(portal_status_message=message))
else:
......
......@@ -18,10 +18,10 @@ if packing_list_list:
# first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation
default = unicode(translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8'))
default=translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }))
return related_object.Base_redirect('view',
keep_items=dict(portal_status_message=message))
else:
......
......@@ -13,13 +13,13 @@ for line in context.getMovementList(
# first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation
default = unicode(translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8'))))
default=translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId()}))))
return context.Base_redirect('view', keep_items=dict(
portal_status_message=translateString(
'No %s Related' % portal_type,
default = unicode(translateString('No ${portal_type} related.',
mapping = { 'portal_type': translateString(portal_type)}), 'utf8'))))
default=translateString('No ${portal_type} related.',
mapping={'portal_type': translateString(portal_type)}))))
......@@ -42,8 +42,8 @@ if len(related_list) == 0:
url = context.absolute_url()
message = Base_translateString(
'No %s Related' % portal_type[0],
default = unicode(Base_translateString('No ${portal_type} related.',
mapping = { 'portal_type': Base_translateString(portal_type[0])}), 'utf8'))
default=Base_translateString('No ${portal_type} related.',
mapping={'portal_type': Base_translateString(portal_type[0])}))
elif len(related_list) == 1:
relation_found = 1
......@@ -63,10 +63,10 @@ elif len(related_list) == 1:
# first, try to get a full translated message with portal types
"%s related to %s." % (related_object.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation
default = unicode(Base_translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type" : related_object.getTranslatedPortalType(),
"that_portal_type" : context.getTranslatedPortalType(),
"that_title" : context.getTitleOrId() }), 'utf8'))
default=Base_translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type": related_object.getTranslatedPortalType(),
"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
else :
url = context.absolute_url()
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