Use number/name in i18n string to avoid breaking existing translations...

This commit is contained in:
Alexandre Aubin 2018-03-10 16:09:16 +01:00
parent 44a66b1ff4
commit 79eb70ec61
2 changed files with 6 additions and 6 deletions

View file

@ -228,10 +228,10 @@
"migrations_bad_value_for_target": "Invalid number for target argument, available migrations numbers are 0 or {}", "migrations_bad_value_for_target": "Invalid number for target argument, available migrations numbers are 0 or {}",
"migrations_cant_reach_migration_file": "Can't access migrations files at path %s", "migrations_cant_reach_migration_file": "Can't access migrations files at path %s",
"migrations_current_target": "Migration target is {}", "migrations_current_target": "Migration target is {}",
"migrations_error_failed_to_load_migration": "ERROR: failed to load migration {migration_id}", "migrations_error_failed_to_load_migration": "ERROR: failed to load migration {number} {name}",
"migrations_forward": "Migrating forward", "migrations_forward": "Migrating forward",
"migrations_list_conflict_pending_done": "You cannot use both --previous and --done at the same time.", "migrations_list_conflict_pending_done": "You cannot use both --previous and --done at the same time.",
"migrations_loading_migration": "Loading migration {migration_id}...", "migrations_loading_migration": "Loading migration {number} {name}...",
"migrations_migration_has_failed": "Migration {number} {name} has failed with exception {exception}, aborting", "migrations_migration_has_failed": "Migration {number} {name} has failed with exception {exception}, aborting",
"migrations_no_migrations_to_run": "No migrations to run", "migrations_no_migrations_to_run": "No migrations to run",
"migrations_show_currently_running_migration": "Running migration {number} {name}...", "migrations_show_currently_running_migration": "Running migration {number} {name}...",

View file

@ -970,9 +970,10 @@ def _load_migration(migration_file):
migration_id = migration_file[:-len(".py")] migration_id = migration_file[:-len(".py")]
number, name = migration_id.split("_", 1)
logger.debug(m18n.n('migrations_loading_migration', logger.debug(m18n.n('migrations_loading_migration',
migration_id=migration_id, number=number, name=name))
))
try: try:
# this is python builtin method to import a module using a name, we # this is python builtin method to import a module using a name, we
@ -985,8 +986,7 @@ def _load_migration(migration_file):
traceback.print_exc() traceback.print_exc()
raise MoulinetteError(errno.EINVAL, m18n.n('migrations_error_failed_to_load_migration', raise MoulinetteError(errno.EINVAL, m18n.n('migrations_error_failed_to_load_migration',
migration_id=migration_id, number=number, name=name))
))
class Migration(object): class Migration(object):