modify strings to ease translation

This commit is contained in:
Benjamin Dauvergne 2019-06-22 16:04:42 +02:00
parent e0071fb470
commit e8171a0dbf
1 changed files with 7 additions and 6 deletions

View File

@ -203,7 +203,7 @@ class ImportUserFormWithExternalId(ImportUserForm):
validators=[
RegexValidator(
r'^[a-zA-Z0-9_-]+$',
_('source_name must no spaces and only letters, digits, - and _'),
_('_source_name must contain no spaces and only letters, digits, - and _'),
'invalid')])
locals()[SOURCE_ID] = forms.CharField(
label=_('Source external id'))
@ -328,7 +328,7 @@ class UserCsvImporter(object):
if header_names & SOURCE_COLUMNS and not SOURCE_COLUMNS.issubset(header_names):
self.add_error(
Error('invalid-external-id-pair',
_('You must have a source_name and a source_id column')))
_('You must have a _source_name and a _source_id column')))
def parse_header(self, head, column):
splitted = head.split()
@ -383,7 +383,7 @@ class UserCsvImporter(object):
if header.name in SOURCE_COLUMNS:
self.add_error(LineError(
'flag-forbidden-on-source-columns',
_('You cannot set flags on source_app and source_id columns'),
_('You cannot set flags on _source_name and _source_id columns'),
line=1))
break
value = True
@ -466,8 +466,8 @@ class UserCsvImporter(object):
if unique_key in unique_map:
errors.append(
Error('unique-constraint-failed',
_('Unique constraint on column "%s" failed: '
'value already appear on line %d') % (header.name, row.line)))
_('Unique constraint on column "%(column)s" failed: '
'value already appear on line %(line)d') % {'column': header.name, 'line': row.line}))
else:
unique_map[unique_key] = row.line
@ -561,9 +561,10 @@ class UserCsvImporter(object):
external_id=source_id)
except IntegrityError:
# should never happen since we have a unique index...
source_full_id = '%s.%s' % (source_name, source_id)
self.errors.append(
Error('external-id-already-exist',
_('External id "%s.%s" already exists') % (source_name, source_id)))
_('External id "%s" already exists') % source_full_id))
raise CancelImport
for cell in row.cells: