Saturday 11 July 2015

Greeting the user in Cornish for #speakcornish week

The events of #speakcornish week, an initiative of MAGA Kernow (The Cornish Language Partnership) along with other Cornish language organisations, have been taking place over the past week.

The way to greet someone in Cornish, depends on the time of day, with Myttin da for "Good morning", Dohajydh da for "Good afternoon" etc.

I have written a Python module to greet the user according to the time of day, at the console. It is available at my Bitbucket account or alternatively below:

# gorhemmyn_kw.py
# David Trethewey
# 11-07-2015
# skrifys rag #speakcornish week 2015
import time
class Gorhemmyn:
    # py termynyow a wra chanjya
    # furv an gorhemmynadow
    bora = 3
    myttin = 7
    dydh = 11
    dohajydh = 14
    gorthugher = 18
    nos = 23
    def __init__(self):
        t = time.localtime()
        our = t.tm_hour
        self.gorhemmyn = "Dydh da" # default
        if our >= Gorhemmyn.nos or our < Gorhemmyn.bora:
            self.gorhemmyn = "Nos da"
        if our >= Gorhemmyn.bora and our < Gorhemmyn.myttin:
            self.gorhemmyn = "Bora da"
        if our >= Gorhemmyn.myttin and our < Gorhemmyn.dydh:
            self.gorhemmyn = "Myttin da"
        if our >= Gorhemmyn.dydh and our < Gorhemmyn.dohajydh:
            self.gorhemmyn = "Dydh da"
        if our >= Gorhemmyn.dohajydh and our < Gorhemmyn.gorthugher:
            self.gorhemmyn = "Dohajydh da"
        if our >= Gorhemmyn.gorthugher and our < Gorhemmyn.nos:
            self.gorhemmyn = "Gorthugher da"

    def pryntya(self):
        print(self.gorhemmyn)

if __name__ == "__main__":
    g = Gorhemmyn()
    g.pryntya()

No comments:

Post a Comment