Skip to content

Commit ae5a9eb

Browse files
author
Milan Topuzov
committed
i18n(base_import_async): use positional args for translations
1 parent 754e438 commit ae5a9eb

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

base_import_async/models/base_import_import.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ def execute_import(self, fields, columns, options, dryrun=False):
5555
translated_model_name = search_result[0][1]
5656
else:
5757
translated_model_name = self._description
58-
description = _("Import %(model)s from file %(from_file)s") % {
59-
"model": translated_model_name,
60-
"from_file": self.file_name,
61-
}
58+
description = _(
59+
"Import %s from file %s", translated_model_name, self.file_name
60+
)
6261
attachment = self._create_csv_attachment(
6362
import_fields, data, options, self.file_name
6463
)
@@ -156,16 +155,13 @@ def _split_file(
156155
):
157156
chunk = str(priority - INIT_PRIORITY).zfill(padding)
158157
description = _(
159-
"Import %(model)s from file %(file_name)s - "
160-
"#%(chunk)s - lines %(from)s to %(to)s"
158+
"Import %s from file %s - #%s - lines %s to %s",
159+
translated_model_name,
160+
file_name,
161+
chunk,
162+
row_from + 1 + header_offset,
163+
row_to + 1 + header_offset,
161164
)
162-
description = description % {
163-
"model": translated_model_name,
164-
"file_name": file_name,
165-
"chunk": chunk,
166-
"from": row_from + 1 + header_offset,
167-
"to": row_to + 1 + header_offset,
168-
}
169165
# create a CSV attachment and enqueue the job
170166
root, ext = splitext(file_name)
171167
attachment = self._create_csv_attachment(

0 commit comments

Comments
 (0)