Moar localization

This commit is contained in:
Alexandre Aubin 2021-09-04 20:34:56 +02:00
parent b06570fb88
commit a062254402
2 changed files with 4 additions and 3 deletions

View file

@ -327,6 +327,7 @@
"extracting": "Extracting...", "extracting": "Extracting...",
"field_invalid": "Invalid field '{}'", "field_invalid": "Invalid field '{}'",
"file_does_not_exist": "The file {path} does not exist.", "file_does_not_exist": "The file {path} does not exist.",
"file_extension_not_accepted": "Refusing file '{path}' because its extension is not among the accepted extensions: {accept}",
"firewall_reload_failed": "Could not reload the firewall", "firewall_reload_failed": "Could not reload the firewall",
"firewall_reloaded": "Firewall reloaded", "firewall_reloaded": "Firewall reloaded",
"firewall_rules_cmd_failed": "Some firewall rule commands have failed. More info in log.", "firewall_rules_cmd_failed": "Some firewall rule commands have failed. More info in log.",

View file

@ -797,7 +797,7 @@ class FileQuestion(Question):
raise YunohostValidationError( raise YunohostValidationError(
"app_argument_invalid", "app_argument_invalid",
field=self.name, field=self.name,
error=m18n.n("file_does_not_exists"), error=m18n.n("file_does_not_exist", path=self.value),
) )
if self.value in [None, ""] or not self.accept: if self.value in [None, ""] or not self.accept:
return return
@ -807,7 +807,7 @@ class FileQuestion(Question):
raise YunohostValidationError( raise YunohostValidationError(
"app_argument_invalid", "app_argument_invalid",
field=self.name, field=self.name,
error=m18n.n("file_extension_not_accepted"), error=m18n.n("file_extension_not_accepted", file=filename, accept=self.accept),
) )
@ -833,7 +833,7 @@ class FileQuestion(Question):
# i.e. os.path.join("/foo", "/etc/passwd") == "/etc/passwd" # i.e. os.path.join("/foo", "/etc/passwd") == "/etc/passwd"
file_path = os.path.normpath(upload_dir + "/" + filename) file_path = os.path.normpath(upload_dir + "/" + filename)
if not file_path.startswith(upload_dir + "/"): if not file_path.startswith(upload_dir + "/"):
raise YunohostError("file_relative_parent_path_in_filename_forbidden") raise YunohostError(f"Filename '{filename}' received from the API got a relative parent path, which is forbidden", raw_msg=True)
i = 2 i = 2
while os.path.exists(file_path): while os.path.exists(file_path):
file_path = os.path.normpath(upload_dir + "/" + filename + (".%d" % i)) file_path = os.path.normpath(upload_dir + "/" + filename + (".%d" % i))