-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlesson-27-value-types.pot
236 lines (207 loc) · 7.69 KB
/
lesson-27-value-types.pot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# Translations template for Learn GDScript From Zero.
# Copyright (C) 2024 GDQuest
# This file is distributed under the same license as the Learn GDScript From
# Zero project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Learn GDScript From Zero \n"
"Report-Msgid-Bugs-To: https://github.com/GDQuest/learn-gdscript\n"
"POT-Creation-Date: 2024-12-12 14:39+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.1\n"
#: course/lesson-27-value-types/lesson.tres:13
msgid ""
"In your code, values have a particular [i]type[/i]. You have already "
"learned about several: whole numbers, decimal numbers, strings, 2D "
"vectors, arrays, and dictionaries.\n"
"\n"
"The computer uses the type of a value to know which operations and "
"functions you can use with them.\n"
"\n"
"As a result, it's essential to understand types: they are not fully "
"compatible with one another, and misusing them will cause errors."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:25
msgid "A prime example"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:27
msgid ""
"You want to display the player's health in the interface. Your code "
"tracks health as a whole number, a value of type [code]int[/code] (short "
"for integer)."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:47
msgid ""
"However, to display it on the player's screen, the computer wants text: "
"it needs a value of type [code]String[/code].\n"
"\n"
"You can concatenate two strings with the [code]+[/code] operator."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:69
msgid "So the following code looks like it could work at first glance."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:89
msgid "But when running the code, we get this strange error."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:109
msgid ""
"It tells you you can't add values of type [code]String[/code] and "
"[code]int[/code]: they're incompatible.\n"
"\n"
"In that case, you need to convert the [code]health[/code] number into a "
"[code]String[/code]."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:119
msgid "Converting values into strings"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:121
msgid ""
"You can get the text representation of a value by calling the "
"[code]str()[/code] function (short for \"string\"). The function returns "
"its argument as a new [code]String[/code].\n"
"\n"
"You can use this function whenever you want to turn some number or vector"
" into text."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:143
msgid ""
"In this case, it turns the number [code]100[/code] into the string "
"[code]\"100\"[/code]. Or whatever number [code]health[/code] is "
"currently."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:151
msgid "Converting strings into numbers"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:153
msgid ""
"You can also convert strings into whole numbers or decimal numbers using "
"respectively the [code]int()[/code] and [code]float()[/code] functions.\n"
"\n"
"Those functions can convert what the player writes in a text field into a"
" number. For example, the number of potions to sell at once in a shop."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:173
msgid "Some types are partially compatible"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:175
msgid ""
"Most types are incompatible. For example, you can't directly add or "
"multiply an array with a number.\n"
"\n"
"However, some types are [i]partially[/i] compatible. For example, you can"
" multiply or divide a vector by a number. "
msgstr ""
#: course/lesson-27-value-types/lesson.tres:197
msgid ""
"It is possible because other developers defined that operation for you "
"under the hood.\n"
"\n"
"However, you cannot directly add or subtract a number to a vector. You'll"
" get an error. That's why, in earlier lessons, you had to access the sub-"
"variables of [code]position[/code] to add numbers to them."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:207
msgid "A surprising result"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:209
msgid ""
"Take the following division: [code]3/2[/code]. What result would you "
"expect to get? [code]1.5[/code]?"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:229
msgid ""
"Well, for the computer, the result of [code]3/2[/code] is [code]1[/code]."
"\n"
"\n"
"Wait, what?!\n"
"\n"
"That's because, for the computer, the division of two whole numbers "
"should always result in a whole number.\n"
"\n"
"When you divide decimal numbers instead, you will get a decimal number as"
" a result."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:255
msgid ""
"Even if it's just a [code]0[/code], adding a decimal place tells the "
"computer we want decimal numbers.\n"
"\n"
"This shows you how mindful you need to be with types. Otherwise, you will"
" get unexpected results. It can get pretty serious: number errors can "
"lead to bugs like controls not working as intended or charging the wrong "
"price to players. "
msgstr ""
#: course/lesson-27-value-types/lesson.tres:265
msgid "Understanding and mastering types is a key skill for developers"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:267
msgid ""
"Programming beginners often struggle due to the lack of understanding of "
"types.\n"
"\n"
"Languages like GDScript hide the types from you by default. As a result, "
"if you don't understand that some are incompatible, you can get stuck "
"when facing type-related errors.\n"
"\n"
"You'll want to keep that in mind in your learning journey. When writing "
"code, you will need to understand everything that's happening.\n"
"\n"
"That said, let's practice some type conversions."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:281
msgid "Displaying the player's health and energy"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:282
msgid ""
"We want to display the player's energy in the user interface.\n"
"\n"
"Currently, our code has a type error. We're trying to display a whole "
"number while the [code]display_energy()[/code] function expects a string."
"\n"
"\n"
"Using the [code]str()[/code] function, clear the type error and make the "
"energy amount display on the interface.\n"
"\n"
"You can't change the [code]energy[/code] variable definition: setting it "
"to [code]\"80\"[/code] would break the rest of the game's code. You must "
"convert the value when calling [code]display_energy()[/code]."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:300
msgid ""
"We want to display the player's energy in the interface but face a type "
"error. Use your new knowledge to fix it."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:305
msgid "Letting the player type numbers"
msgstr ""
#: course/lesson-27-value-types/lesson.tres:306
msgid ""
"In our game's shops, we want to let the player type numbers to select the"
" number of items they want to buy or sell.\n"
"\n"
"We need to know the number of items as an [code]int[/code], but the "
"computer reads the player's input as a [code]String[/code].\n"
"\n"
"Your task is to convert the player's input into numbers for the shop's "
"code to work.\n"
"\n"
"Using the [code]int()[/code] function, convert the player's input into a "
"whole number and store the result in the [code]item_count[/code] "
"variable."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:326
msgid ""
"We want the player to choose the number of items they buy or sell in our "
"game's shops. But right now, all we get are type errors."
msgstr ""
#: course/lesson-27-value-types/lesson.tres:330
msgid "Value types"
msgstr ""