Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -28,13 +28,32 @@ def load_translations(filename):
|
|
28 |
return translations
|
29 |
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
|
|
|
|
|
|
34 |
@app.route('/')
|
35 |
def index():
|
36 |
return render_template('index.html', translations=translations)
|
37 |
|
|
|
|
|
|
|
38 |
|
39 |
@app.route('/vote/<int:id>/<string:action>')
|
40 |
def vote(id, action):
|
|
|
28 |
return translations
|
29 |
|
30 |
|
31 |
+
def load_translations_fang(filename):
|
32 |
+
translations = []
|
33 |
+
with open(filename, 'r', encoding='utf-8') as file:
|
34 |
+
reader = csv.DictReader(file)
|
35 |
+
for i, row in enumerate(reader):
|
36 |
+
translations.append({
|
37 |
+
"id": i,
|
38 |
+
"français": row["français"],
|
39 |
+
"fangs": row["fang"],
|
40 |
+
"likes": 0,
|
41 |
+
"dislikes": 0,
|
42 |
+
"feedback_sent": False
|
43 |
+
})
|
44 |
+
return translations
|
45 |
|
46 |
|
47 |
+
translations = load_translations('translations.csv')
|
48 |
+
fang_translation = load_translations_fang("fang.csv")
|
49 |
+
|
50 |
@app.route('/')
|
51 |
def index():
|
52 |
return render_template('index.html', translations=translations)
|
53 |
|
54 |
+
@app.route('/')
|
55 |
+
def index():
|
56 |
+
return render_template('fang.html', translations=fang_translation)
|
57 |
|
58 |
@app.route('/vote/<int:id>/<string:action>')
|
59 |
def vote(id, action):
|