Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5431e6

Browse files
committed
Merge branch 'using-translations' into translation-preview
2 parentsa31752c +0f2e3f8 commita5431e6

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

‎core/chapters/c08_nested_loops.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def solution(self):
435435
left+=1
436436
forrightinrange(12):
437437
right+=1
438-
#workaround while translation is in progress
438+
#for the sake of translation
439439
print(f'{left} x{right} ={left*right}'.replace('x','*'))
440440
print('----------')
441441

‎core/translation.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def get(msgid, default):
4444

4545
result=translation.gettext(msgid)
4646
ifresult==msgid:
47-
# TODO chapters and special messages should be translated
48-
assertmsgid.startswith(("code_bits.","chapters."))or"output_prediction_choices"inmsgidor".special_messages."inmsgid
47+
assertmsgid.startswith(("code_bits."))or"output_prediction_choices"inmsgid
4948
returndefault
5049

5150
defreplace(match):
@@ -95,6 +94,8 @@ def get_code_bits(code):
9594
continue
9695
elifisinstance(node, (ast.FunctionDef,ast.ClassDef,ast.AsyncFunctionDef)):
9796
forarginnode.args.args:
97+
iflen(arg.arg)==1:
98+
continue
9899
yieldarg,arg.arg
99100
node_text=node.name
100101
elifisinstance(node, (ast.Str,ast.JoinedStr)):

‎tests/test_steps.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importjson
22
importos
3+
importrandom
34
importre
45
frompathlibimportPath
56

@@ -13,6 +14,9 @@
1314

1415
core.utils.TESTING=True
1516

17+
random.seed(0)
18+
19+
1620
deftest_steps():
1721
t.set_language("es")
1822
list(load_chapters())

‎tests/test_transcript.json‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"'literally anything'"
66
],
77
"response": {
8-
"message":"<p>Fabuloso,\u00a1est\u00e1s probando tus propios experimentos!\nEs una gran se\u00f1al. Sigue as\u00ed.\nS\u00f3lo te hago saber que al final tienes que escribir <code>1+2</code> para queel libro avance.</p>",
8+
"message":"<p>Fabuloso,\u00a1est\u00e1s probando tus propios experimentos!\nEs una gran se\u00f1al. Sigue as\u00ed.\nS\u00f3lo te hago saber que al final tienes que escribir <code>1+2</code> para quela lecci\u00f3n avance.</p>",
99
"passed":false,
1010
"result": [
1111
{
@@ -4034,15 +4034,15 @@
40344034
],
40354035
"page":"f-strings",
40364036
"program": [
4037-
"gente = ['UQesqvN', 'HwYQXfmKI', 'nOQmWB', 'ARtYrHaPL', 'cYPFNHBt', 'owaUWeiulB', 'cZRrE', 'brHQFoazeJ']",
4037+
"gente = ['xXHpwj', 'KviHqnTYy', 'UwalMAWd', 'pCldL', 'ILiVG', 'WupPwbGR', 'WsnkbMl', 'lAMDfz']",
40384038
"print(f\"Hay {len(gente)} personas esperando, el nombre de la primera es {gente[0]}.\")"
40394039
],
40404040
"response": {
40414041
"message":"",
40424042
"passed":true,
40434043
"result": [
40444044
{
4045-
"text":"Hay 8 personas esperando, el nombre de la primera esUQesqvN.\n",
4045+
"text":"Hay 8 personas esperando, el nombre de la primera esxXHpwj.\n",
40464046
"type":"stdout"
40474047
}
40484048
]
@@ -4198,7 +4198,7 @@
41984198
" izquierda += 1",
41994199
" for derecha in range(12):",
42004200
" derecha += 1",
4201-
" #workaround while translation is in progress",
4201+
" #for the sake of translation",
42024202
" print(f'{izquierda} x {derecha} = {izquierda * derecha}'.replace('x', '*'))",
42034203
" print('----------')"
42044204
],
@@ -6581,7 +6581,7 @@
65816581
],
65826582
"page":"Tipos de Dato",
65836583
"program": [
6584-
"numero = '9'",
6584+
"numero = '7'",
65856585
"for i in range(int(numero)):",
65866586
" print('Comenzando...' + str(i + 1))",
65876587
"print('\u00a1V\u00e9!')"
@@ -6591,7 +6591,7 @@
65916591
"passed":true,
65926592
"result": [
65936593
{
6594-
"text":"Comenzando...1\nComenzando...2\nComenzando...3\nComenzando...4\nComenzando...5\nComenzando...6\nComenzando...7\nComenzando...8\nComenzando...9\n\u00a1V\u00e9!\n",
6594+
"text":"Comenzando...1\nComenzando...2\nComenzando...3\nComenzando...4\nComenzando...5\nComenzando...6\nComenzando...7\n\u00a1V\u00e9!\n",
65956595
"type":"stdout"
65966596
}
65976597
]
@@ -6632,7 +6632,7 @@
66326632
{
66336633
"page":"Programas interactivos con <code>input()</code>",
66346634
"program": [
6635-
"print('Digita tu nombre y presiona Enter:')",
6635+
"print('Escribe tu nombre y presiona Enter:')",
66366636
"nombre = input()",
66376637
"print(f'Hola {nombre}!')"
66386638
],
@@ -6641,7 +6641,7 @@
66416641
"passed":true,
66426642
"result": [
66436643
{
6644-
"text":"Digita tu nombre y presiona Enter:\n",
6644+
"text":"Escribe tu nombre y presiona Enter:\n",
66456645
"type":"stdout"
66466646
},
66476647
{
@@ -6693,7 +6693,7 @@
66936693
"type":"input_prompt"
66946694
},
66956695
{
6696-
"text":"<input:1>\n",
6696+
"text":"<input:4>\n",
66976697
"type":"stdout"
66986698
},
66996699
{
9 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp