Skip to content

Commit

Permalink
add timers.genie for Chinese
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychhsu committed Feb 27, 2019
1 parent 88540ed commit 5415219
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions languages/zh-tw/timers.genie
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of ThingTalk
//
// Copyright 2017-2018 The Board of Trustees of the Leland Stanford Junior University
//
// Author: Giovanni Campagna <gcampagn@cs.stanford.edu>
//
// See COPYING for details

{
const ThingTalk = require('thingtalk');
const Ast = ThingTalk.Ast;

const TIMER_SCHEMA = new Ast.FunctionDef('stream',
'timer',
[], // args,
false, // is_list
true, // is_monitorable
{
canonical: '每固定週期',
confirmation: '每 ${interval}',
},
{} // annotations
);

const AT_TIMER_SCHEMA = new Ast.FunctionDef('stream',
'attimer',
[], // args,
false, // is_list
true, // is_monitorable
{
canonical: '每天的固定時間',
confirmation: '每天的 ${interval}',
},
{} // annotations
);
}

timer = {
'每天的' time:constant_Time => new Ast.Stream.AtTimer(time, AT_TIMER_SCHEMA);
'每天在' time:constant_Time '的時候' => new Ast.Stream.AtTimer(time, AT_TIMER_SCHEMA);

!turking {
// TODO : Need to handle duration in Chinese
'每' interval:constant_Measure_ms => new Ast.Stream.Timer(Ast.Value.Date.now(), interval, TIMER_SCHEMA);
'每天' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'day'), TIMER_SCHEMA);
'一天一次' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'day'), TIMER_SCHEMA);
'每月' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'mon'), TIMER_SCHEMA);
'每個月' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'mon'), TIMER_SCHEMA);
'一個月一次' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'mon'), TIMER_SCHEMA);
'每週' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'week'), TIMER_SCHEMA);
'一週一次' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'week'), TIMER_SCHEMA);
'每小時' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'h'), TIMER_SCHEMA);
'每一小時' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'h'), TIMER_SCHEMA);
'每小時一次' => new Ast.Stream.Timer(Ast.Value.Date.now(), new Ast.Value.Measure(1, 'h'), TIMER_SCHEMA);
}
}

0 comments on commit 5415219

Please sign in to comment.