|
4 | 4 | "version": 1 |
5 | 5 | }, |
6 | 6 |
|
7 | | - "glossary": { |
| 7 | + "glossaryForTranslators": { |
8 | 8 | "about": "Tokens written as {{token_name}} are filled in automatically at render time with real values from the Python error. You may move them to suit your language's word order, but do not translate, rename, or remove them. No HTML is needed around them as styling is applied automatically. Keys starting with _ are metadata for translators - do not translate or modify them.", |
9 | 9 | "tokens": { |
10 | 10 | "name": { |
|
36 | 36 | "variants": [ |
37 | 37 | { |
38 | 38 | "if": { |
39 | | - "not_message": ["is not defined"] |
| 39 | + "match_message": ["cannot access free variable", "not associated with a value"] |
40 | 40 | }, |
41 | | - "title": "This variable doesn't exist yet", |
42 | | - "summary": "Your code uses the variable {{name}}, but it hasn't been created yet. Check {{loc}}. If you meant to print the text {{name}}, put it in double quotes.", |
43 | | - "why": "Without speech marks Python treats {{name}} as a variable, and this variable does not exist yet.", |
| 41 | + "title": "Variable used before it gets a value here", |
| 42 | + "summary": "{{name}} is used at {{loc}} before it has been given a value in the function that surrounds it. It is set later, but not before it is used.", |
| 43 | + "why": "A variable from an enclosing function only becomes available once the line that assigns it has run. Using it earlier - for example from an inner function that runs first - leaves it without a value.", |
44 | 44 | "steps": [ |
45 | | - "If it is meant to be text, put speech marks around {{name}}.", |
46 | | - "If it is meant to be a variable, make it first (for example: {{name}} = 0).", |
47 | | - "Check spelling and capital letters." |
| 45 | + "Give {{name}} a value before the line that uses it.", |
| 46 | + "If an inner function needs it, pass the value in as an argument instead of relying on the enclosing scope." |
48 | 47 | ], |
49 | 48 | "_placeholders": { |
50 | | - "name": "The undefined variable name, e.g. kittens", |
51 | | - "loc": "Where it was used, e.g. line 2 in main.py" |
| 49 | + "name": "The enclosing-scope variable name, e.g. total", |
| 50 | + "loc": "Where it was used, e.g. line 3 in main.py" |
52 | 51 | } |
53 | 52 | }, |
54 | 53 | { |
55 | 54 | "if": { |
56 | 55 | "match_message": ["is not defined"] |
57 | 56 | }, |
58 | | - "title": "This variable doesn't exist here", |
59 | | - "summary": "{{name}} might be created somewhere else, but you're using it at {{loc}}. If you meant the text {{name}}, put it in double quotes.", |
60 | | - "why": "A variable created in another place might not be available here.", |
| 57 | + "title": "This variable doesn't exist yet", |
| 58 | + "summary": "Your code uses the variable {{name}}, but this hasn't been created yet. Check {{loc}}. If you meant to print the text {{name}}, put it in double quotes.", |
| 59 | + "why": "Without speech marks Python treats {{name}} as a variable and this variable does not exist yet.", |
61 | 60 | "steps": [ |
62 | | - "Move the line that makes it to above where you use it.", |
63 | | - "Or set it here just before you use it." |
| 61 | + "If it is meant to be text put speech marks around {{name}}.", |
| 62 | + "If it is meant to be a variable make it first (for example: {{name}} = 0).", |
| 63 | + "Check spelling and capital letters." |
64 | 64 | ], |
65 | 65 | "_placeholders": { |
66 | | - "name": "The variable name used out of scope, e.g. total", |
67 | | - "loc": "Where it was referenced, e.g. line 8 in main.py" |
| 66 | + "name": "The undefined variable name, e.g. kittens", |
| 67 | + "loc": "Where it was used, e.g. line 2 in main.py" |
68 | 68 | } |
69 | 69 | } |
70 | 70 | ] |
|
0 commit comments