Skip to content

Commit 0e9c4e0

Browse files
committed
Add placeholders and glossary (for translators) to copydeck
1 parent f7872b7 commit 0e9c4e0

1 file changed

Lines changed: 58 additions & 8 deletions

File tree

copydecks/en/copydeck.json

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
"language": "en",
44
"version": 1
55
},
6+
7+
"glossary": {
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+
"tokens": {
10+
"name": {
11+
"description": "The Python variable or identifier that caused the error.",
12+
"example": "score"
13+
},
14+
"loc": {
15+
"description": "The line number and filename where the error occurred.",
16+
"example": "line 5 in main.py"
17+
},
18+
"codeLine": {
19+
"description": "The exact source code line that caused the error.",
20+
"example": "for i in range(3)"
21+
}
22+
}
23+
},
24+
625
"ui": {
726
"line": "line",
827
"in": "in",
@@ -29,7 +48,11 @@
2948
"If it is meant to be text, put speech marks around {{name}}.",
3049
"If it is meant to be a variable, make it first (for example: {{name}} = 0).",
3150
"Check spelling and capital letters."
32-
]
51+
],
52+
"_placeholders": {
53+
"name": "The undefined variable name, e.g. kittens",
54+
"loc": "Where it was used, e.g. line 2 in main.py"
55+
}
3356
},
3457
{
3558
"if": {
@@ -41,7 +64,11 @@
4164
"steps": [
4265
"Move the line that makes it to above where you use it.",
4366
"Or set it here just before you use it."
44-
]
67+
],
68+
"_placeholders": {
69+
"name": "The variable name used out of scope, e.g. total",
70+
"loc": "Where it was referenced, e.g. line 8 in main.py"
71+
}
4572
}
4673
]
4774
},
@@ -54,7 +81,11 @@
5481
"why": "You have used the variable before it has been given a value. If used within a subroutine, the variable must either be global and given a value outside the subroutine definition, or local and given a value inside the subroutine, before it is used. ",
5582
"steps": [
5683
"Give it a value first (add a line like {{name}} = ... before you use it)."
57-
]
84+
],
85+
"_placeholders": {
86+
"name": "The variable used before assignment, e.g. score",
87+
"loc": "Where it was read before being set, e.g. line 4 in main.py"
88+
}
5889
}
5990
]
6091
},
@@ -71,7 +102,11 @@
71102
"why": "In Python constructs like if statements, for loops and while loops must have a colon at the end of their first line.",
72103
"steps": [
73104
"Add a colon (:) at the end of that line."
74-
]
105+
],
106+
"_placeholders": {
107+
"loc": "Where the missing colon is, e.g. line 3 in main.py",
108+
"codeLine": "The line that needs the colon, e.g. for i in range(10)"
109+
}
75110
},
76111
{
77112
"if": {
@@ -82,7 +117,11 @@
82117
"why": "Lines that start a block (like if or for) need a colon, not a comma.",
83118
"steps": [
84119
"Replace the comma with a colon (:)."
85-
]
120+
],
121+
"_placeholders": {
122+
"loc": "Where the comma is, e.g. line 1 in main.py",
123+
"codeLine": "The line ending with a comma, e.g. if score > 10,"
124+
}
86125
},
87126
{
88127
"if": {
@@ -93,7 +132,11 @@
93132
"why": "A block-starting line needs exactly one colon at the end.",
94133
"steps": [
95134
"Leave only one colon (:) at the end of the line."
96-
]
135+
],
136+
"_placeholders": {
137+
"loc": "Where the extra colon is, e.g. line 2 in main.py",
138+
"codeLine": "The line with double colons, e.g. if x > 0::"
139+
}
97140
},
98141
{
99142
"if": {
@@ -159,7 +202,11 @@
159202
"steps": [
160203
"Use == to compare values in if, elif, or while conditions.",
161204
"Keep = for setting a variable value outside comparisons."
162-
]
205+
],
206+
"_placeholders": {
207+
"loc": "Where the = is used in a condition, e.g. line 6 in main.py",
208+
"codeLine": "The condition line, e.g. if score = 10:"
209+
}
163210
},
164211
{
165212
"if": {
@@ -208,7 +255,10 @@
208255
"steps": [
209256
"Use 4 spaces per level (not tabs).",
210257
"Line up all lines in the block."
211-
]
258+
],
259+
"_placeholders": {
260+
"loc": "Where the indentation problem is, e.g. line 7 in main.py"
261+
}
212262
}
213263
]
214264
},

0 commit comments

Comments
 (0)