Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from flask import Flask, render_template, request, redirect, url_for
|
2 |
-
from translation_data import translation_dict_A, translation_dict_B, translation_dict_C, translation_dict_D
|
3 |
|
4 |
app = Flask(__name__)
|
5 |
|
@@ -12,6 +12,10 @@ english_sentences_C = list(translation_dict_C.keys())
|
|
12 |
japanese_translations_C = list(translation_dict_C.values())
|
13 |
english_sentences_D = list(translation_dict_D.keys())
|
14 |
japanese_translations_D = list(translation_dict_D.values())
|
|
|
|
|
|
|
|
|
15 |
|
16 |
@app.route('/')
|
17 |
def portal():
|
@@ -37,6 +41,14 @@ def index():
|
|
37 |
english = english_sentences_D[index]
|
38 |
japanese = japanese_translations_D[index]
|
39 |
total = len(english_sentences_D)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
return render_template('index.html', set_name=set_name, index=index, english=english, japanese=japanese, total=total)
|
41 |
|
42 |
@app.route('/next')
|
@@ -51,6 +63,10 @@ def next_card():
|
|
51 |
index = 0
|
52 |
elif set_name == 'D' and index >= len(english_sentences_D):
|
53 |
index = 0
|
|
|
|
|
|
|
|
|
54 |
return redirect(url_for('index', set=set_name, index=index))
|
55 |
|
56 |
@app.route('/prev')
|
@@ -66,6 +82,10 @@ def prev_card():
|
|
66 |
index = len(english_sentences_C) - 1
|
67 |
elif set_name == 'D':
|
68 |
index = len(english_sentences_D) - 1
|
|
|
|
|
|
|
|
|
69 |
return redirect(url_for('index', set=set_name, index=index))
|
70 |
|
71 |
if __name__ == '__main__':
|
|
|
1 |
from flask import Flask, render_template, request, redirect, url_for
|
2 |
+
from translation_data import translation_dict_A, translation_dict_B, translation_dict_C, translation_dict_D, translation_dict_F, translation_dict_G
|
3 |
|
4 |
app = Flask(__name__)
|
5 |
|
|
|
12 |
japanese_translations_C = list(translation_dict_C.values())
|
13 |
english_sentences_D = list(translation_dict_D.keys())
|
14 |
japanese_translations_D = list(translation_dict_D.values())
|
15 |
+
english_sentences_F = list(translation_dict_F.keys())
|
16 |
+
japanese_translations_F = list(translation_dict_F.values())
|
17 |
+
english_sentences_G = list(translation_dict_G.keys())
|
18 |
+
japanese_translations_G = list(translation_dict_G.values())
|
19 |
|
20 |
@app.route('/')
|
21 |
def portal():
|
|
|
41 |
english = english_sentences_D[index]
|
42 |
japanese = japanese_translations_D[index]
|
43 |
total = len(english_sentences_D)
|
44 |
+
elif set_name == 'F':
|
45 |
+
english = english_sentences_F[index]
|
46 |
+
japanese = japanese_translations_F[index]
|
47 |
+
total = len(english_sentences_F)
|
48 |
+
elif set_name == 'G':
|
49 |
+
english = english_sentences_G[index]
|
50 |
+
japanese = japanese_translations_G[index]
|
51 |
+
total = len(english_sentences_G)
|
52 |
return render_template('index.html', set_name=set_name, index=index, english=english, japanese=japanese, total=total)
|
53 |
|
54 |
@app.route('/next')
|
|
|
63 |
index = 0
|
64 |
elif set_name == 'D' and index >= len(english_sentences_D):
|
65 |
index = 0
|
66 |
+
elif set_name == 'F' and index >= len(english_sentences_F):
|
67 |
+
index = 0
|
68 |
+
elif set_name == 'G' and index >= len(english_sentences_G):
|
69 |
+
index = 0
|
70 |
return redirect(url_for('index', set=set_name, index=index))
|
71 |
|
72 |
@app.route('/prev')
|
|
|
82 |
index = len(english_sentences_C) - 1
|
83 |
elif set_name == 'D':
|
84 |
index = len(english_sentences_D) - 1
|
85 |
+
elif set_name == 'F':
|
86 |
+
index = len(english_sentences_F) - 1
|
87 |
+
elif set_name == 'G':
|
88 |
+
index = len(english_sentences_G) - 1
|
89 |
return redirect(url_for('index', set=set_name, index=index))
|
90 |
|
91 |
if __name__ == '__main__':
|