-
Notifications
You must be signed in to change notification settings - Fork 3
/
Chinese.yaml
82 lines (80 loc) · 2.52 KB
/
Chinese.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
substitutions:
# Based on the following time & date formats (24 hour format should be unaffected):
time_format12: "%l:%M%p" # 1:25PM
date_format: "%b %d" # Jan 01
date_formatA: "%a" # Mon
font:
- file: fonts/MatrixChunky8X.ttf
id: default_font
size: 8
glyphs: |
0123456789:.Sun MoTesWdhFriatAPJbpylgOcNvD上下午月一二三四五六七八九十星期天
# Above covers Sun Mon Tues Wed Thu Fri Sat AM PM Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec as well as Chinese Dates/Times
text_sensor:
- platform: template
id: time_text
name: "$friendly_name Replacement Time Text"
entity_category: diagnostic
update_interval: never
internal: true
filters:
- append: ""
- prepend: ""
- substitute:
// Chinese generally puts the 上午/下午 before the time, so let's just use a different format entirely "%p%l%M" (PM1:25) and run a substitute on it
if (id(hour12_mode) == 1) {
int offset = 0;
// delete next 3 lines if using the HA version...
if (id(tzoffset_on) != 0) {
offset = (int)(60 * 60 * (id(tzoffset)));
}
std::time_t tz1time = (id(my_time).now().timestamp + offset);
std::tm *tz1time_astm = localtime(&tz1time);
char display_tmdt[20];
strftime(display_tmdt, 20, "%p%l:%M", tz1time_astm);
std::string tmdt(display_tmdt);
return tmdt;
} else {
return x;
}
- "AM -> 上午"
- "PM -> 下午"
- platform: template
id: date_text
name: "$friendly_name Replacement Date Text"
entity_category: diagnostic
update_interval: never
internal: true
filters:
- append: ""
- prepend: ""
- substitute:
- "Jan -> 一月"
- "Feb -> 二月"
- "Mar -> 三月"
- "Apr -> 四月"
- "May -> 五月"
- "Jun -> 六月"
- "Jul -> 七月"
- "Aug -> 八月"
- "Sep -> 九月"
- "Oct -> 十月"
- "Nov -> 十一月"
- "Dec -> 十二月"
- platform: template
id: dateA_text
name: "$friendly_name Replacement Date A Text"
entity_category: diagnostic
update_interval: never
internal: true
filters:
- append: ""
- prepend: ""
- substitute:
- "Sun -> 星期天"
- "Mon -> 星期一"
- "Tue -> 星期二"
- "Wed -> 星期三"
- "Thu -> 星期四"
- "Fri -> 星期五"
- "Sat -> 星期六"