File tree 4 files changed +48
-2
lines changed
4 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ def render():
38
38
publish_timestamp = validate_int (request , "timestamp" , default = 0 )
39
39
duration_seconds = validate_int (request , "duration" , default = 0 )
40
40
lang = validate_lang (request , "lang" , default = "en" )
41
+ rtl = lang in ["ar" , "he" ]
41
42
video_id = validate_video_id (request , "id" )
42
43
thumbnail = data_uri_from_url (f"https://i.ytimg.com/vi/{ video_id } /mqdefault.jpg" )
43
44
views = fetch_views (video_id )
@@ -62,6 +63,7 @@ def render():
62
63
thumbnail = thumbnail ,
63
64
duration = duration ,
64
65
duration_width = duration_width ,
66
+ rtl = rtl ,
65
67
),
66
68
status = 200 ,
67
69
mimetype = "image/svg+xml" ,
Original file line number Diff line number Diff line change
1
+ he :
2
+ views : " %{number} צפיות"
3
+ seconds-ago :
4
+ one : " לפני שניה"
5
+ many : " לפני %{count} שניות"
6
+ minutes-ago :
7
+ one : " לפני דקה"
8
+ many : " לפני %{count} דקות"
9
+ hours-ago :
10
+ one : " לפני שעה"
11
+ many : " לפני %{count} שעות"
12
+ days-ago :
13
+ one : " אתמול"
14
+ many : " לפני %{count} ימים"
15
+ months-ago :
16
+ one : " לפני חודש"
17
+ many : " לפני %{count} חודשים"
18
+ years-ago :
19
+ one : " לפני שנה"
20
+ many : " לפני %{count} שנים"
Original file line number Diff line number Diff line change @@ -71,3 +71,27 @@ def test_request_valid_params(client):
71
71
# test timestamp
72
72
timestamp_regex = re .compile (r"\d+ years ago" )
73
73
assert timestamp_regex .search (data ) is not None
74
+
75
+ # test direction
76
+ assert 'style="direction: ltr"' in data
77
+
78
+
79
+ def test_request_right_to_left (client ):
80
+ params = {
81
+ "id" : "dQw4w9WgXcQ" ,
82
+ "title" : "Rick Astley - Never Gonna Give You Up (Official Music Video)" ,
83
+ "timestamp" : "1256450400" ,
84
+ "lang" : "he" ,
85
+ }
86
+ response = client .get (f"/?{ urlencode (params )} " )
87
+ data = response .data .decode ("utf-8" )
88
+
89
+ # stats group should be 10 pixels from the right
90
+ assert "translate(240, 195.0)" in data
91
+
92
+ # test direction
93
+ assert 'style="direction: rtl"' in data
94
+
95
+ # test views
96
+ views_regex = re .compile (r"\d+(?:\.\d)?[KMBT]? צפיות" )
97
+ assert views_regex .search (data ) is not None
You can’t perform that action at this time.
0 commit comments