Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt basque #33

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions make/Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ python-tests:
lint: python-lint js-lint

python-lint:
PYTHONPATH=$(shell pwd)/webserver \
python -m pylama

js-lint:
Expand Down
85 changes: 85 additions & 0 deletions static/css/controller.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion static/css/controller.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions static/js/internationalisation/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./languages/cy.js";
export * from "./languages/en.js";
export * from "./languages/es.js";
export * from "./languages/eu.js";
50 changes: 50 additions & 0 deletions static/js/internationalisation/languages/eu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export let eu = {
name: "Basque",
data: [
[
{ class: "oclock", text: "ordu" },
{ text: "ab" },
{ class: "h-4", text: "laurak" },
],
[
{ class: "h-2", text: "biak" },
{ text: "c" },

{ class: "h-3", text: "hirarak" },
],
[
{ class: "h-6", text: "seiak" },
{ class: "h-7", text: "zazpiak" },
],
[{ class: "h-9", text: "bederatziak" }, { text: "e" }],
[
{ class: "h-1", text: "bata" },
{ class: "h-10", text: "hamarrak" },
],
[{ class: "h-11", text: "hamaikak" }, { text: "fghi" }],
[{ text: "jklm" }, { class: "h-0", text: "hamabiak" }],
[{ class: "h-8", text: "zortziak" }, { text: "nopq" }],
[
{ class: "h-5", text: "bostak" },
{ text: "r" },
{ class: "past", text: "eta" },
{ class: "to", text: "da" },
],
[
{ text: "d" },
{ class: "half", text: "erdiak" },
{ class: "ten", text: "hamar" },
],
[
{ classes: ["twenty", "twentyfive"], text: "hogei" },
{ class: "twentyfive", text: "ta" },
{ class: "five", text: "bost" },
{ text: "t" },
],
[
{ class: "quarter", text: "laurden" },
{ text: "u" },
{ classes: ["it", "is"], text: "dira" },
],
],
};
112 changes: 112 additions & 0 deletions static/js/internationalisation/samples/eu/eu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
12:00
hamabiak dira

12:05
hamabiak eta bost dira

12:10
hamabiak eta hamarrak dira

12:15
hamabi eta laurdenak dira

12:20
hamabiak eta hogei dira

12:25
hamabiak eta hogeita bost dira

12:30
hamabi eta erdiak dira

12:35
hogeita bost bata da

12:40
hogeita bat da

12:45
bata eta laurdena da

12:50
hamarreko bat da

12:55
bost bata da

13:00
ordu bata da

13:05
ordu bata eta bost dira

13:10
bata eta hamarrak dira

13:15
ordu laurdenak dira

13:20
bat eta hogei dira

13:25
hogeita bost eta bata da

13:30
ordu bat eta erdiak dira

13:35
hogeita bost eta bi da

13:40
hogeita bi da

13:45
ordu biak laurdenak dira

13:50
hamar eta bi da

13:55
bost edo bi da

14:00
ordu biak dira

---

13:00
ordu bata da

14:00
ordu biak dira

15:00
hirurak dira

16:00
laurak dira

17:00
bostak dira

18:00
seiak dira

19:00
zazpiak dira

20:00
zortziak dira

21:00
bederatziak dira

22:00
hamarrak dira

23:00
hamaikak dira

24:00
hamabiak dira
28 changes: 28 additions & 0 deletions static/js/internationalisation/samples/eu/groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
https://www.masteranylanguage.com/c/b/en/28-Basque-Master-How-To-Tell-Time

13:00: ordu bata xx
14:00: ordu biak xx
15:00: ordu hirarak xx
16:00: ordu laurak xx
17:00: ordu bostak xx
18:00: ordu seiak xx
19:00: ordu zazpiak xx
20:00: ordu zortziak xx
21:00: ordu bederatziak xx
22:00: ordu hamarrak xx
23:00: ordu hamaikak xx
00:00: ordu hamabiak xx

and (past): eta xx
to (before): da, gutxiago?

five: bost xx
ten: hamar
quarter: laurden xx
twenty: hogei xx
twentyfive: hogeita bost xx
half: erdiak xx

---

use ordu for `past` only?
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export let no = {
name: "Norwegian",
data: [],
};
24 changes: 12 additions & 12 deletions tests/webserver/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
import redis

from webserver.controller import app
from webserver.redis_manager import RedisManager

headers = {"Accept": "application/json", "Content-type": "application/json"}
redis = redis.StrictRedis(encoding="utf-8", decode_responses=True)


class TestWebserver(TestCase):
class TestController(TestCase):
"""Test the webserver."""

def setUp(self):
"""Do some initialisation."""
app.env = "test"
app.redis.set("test:style:current", "phony-style")
app.redis.set("test:language:current", "pl")
app.redis.set("test:style:valids", json.dumps(["phony-style", "some-style"]))
app.redis.set(
app.redis_manager = RedisManager(namespace="test", flush=True)
app.redis_manager.redis.set("test:style:current", "phony-style")
app.redis_manager.redis.set("test:language:current", "pl")
app.redis_manager.redis.set(
"test:style:valids", json.dumps(["phony-style", "some-style"])
)
app.redis_manager.redis.set(
"test:language:valids", json.dumps({"pl": "Polish", "ru": "Russian"})
)

def tearDown(self):
"""Clean-up after ourselves."""
redis.flushall()

def test_root(self):
"""Test '/'."""
client = app.test_client()
Expand All @@ -49,7 +49,7 @@ def test_set_style(self):
self.assertEqual(
json.loads(response.data), {"status": "OK", "style": "phony-style"}
)
self.assertEqual(redis.get("test:style:current"), "phony-style")
# self.assertEqual(redis.get("test:style:current"), "phony-style")

def test_set_bad_style(self):
"""Test it rejects an invalid `style`."""
Expand All @@ -68,7 +68,7 @@ def test_set_bad_style(self):

def test_get_style(self):
"""Test getting the `style`."""
redis.set("test:style:current", "some-style")
app.redis_manager.set("style", "some-style")
client = app.test_client()
response = client.get("/style", headers=headers)
self.assertEqual(response.status_code, 200)
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_set_bad_language(self):

def test_get_language(self):
"""Test getting the `language`."""
redis.set("test:language:current", "ru")
app.redis_manager.set("language", "ru")
client = app.test_client()
response = client.get("/language", headers=headers)
self.assertEqual(response.status_code, 200)
Expand Down
6 changes: 6 additions & 0 deletions tests/webserver/test_dodgy_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import redis

from webserver.controller import app
from webserver.redis_manager import RedisManager

headers = {"Accept": "application/json", "Content-type": "application/json"}
redis = redis.Redis()
Expand All @@ -12,6 +13,11 @@
class TestWithDodgyPayload(TestCase):
"""Test it handles no POST data."""

def setUp(self):
"""Do some initialisation."""
app.env = "test"
app.redis_manager = RedisManager(namespace="test", flush=True)

def test_with_no_post_data(self):
"""Test it responds nicely to no POST data."""
client = app.test_client()
Expand Down
Loading