Actions
Patch #39207
closedReplace `YAML.load` with `YAML.load_file` in locales.rake and improve error reporting for invalid YAML files
Description
The attached patch replaces YAML.load
with YAML.load_file
in lib/tasks/locales.rake and improves the error message when `rake locales` fail to parse a translation file.
Suppose config/locales/tr.yml is not a valid YAML file and rake locales
raises an error. As shown in the example below, after the improvement, the name of the file containing the problem will be displayed instead of "<unknown>", making it easier to identify which file contains the problem.
Before:
Updating file ./config/locales/tr.yml rake aborted! Psych::SyntaxError: (<unknown>): did not find expected key while parsing a block mapping at line 7 column 3
After:
Updating file ./config/locales/tr.yml rake aborted! Psych::SyntaxError: (./config/locales/tr.yml): did not find expected key while parsing a block mapping at line 7 column 3
Files
Actions