Display Chinese Lunar Calendar in panel ⚠⚠⚠ dependency: ChineseCalendar by ytliu0: https://gitlab.gnome.org/Nei/ChineseCalendar/-/archive/20240107/ChineseCalendar-20240107.tar.gz
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
Version | Status |
---|---|
49 | Active |
48 | Active |
47 | Active |
46 | Active |
45 | Rejected |
44 | Active |
43 | Active |
42 | Active |
41 | Active |
40 | Rejected |
39 | Rejected |
38 | Active |
37 | Rejected |
36 | Active |
35 | Active |
34 | Rejected |
33 | Active |
32 | Active |
31 | Rejected |
30 | Active |
29 | Active |
28 | Active |
27 | Active |
26 | Active |
25 | Active |
24 | Rejected |
23 | Active |
22 | Active |
21 | Active |
20 | Active |
19 | Active |
18 | Active |
17 | Rejected |
16 | Active |
15 | Active |
14 | Active |
13 | Active |
12 | Active |
11 | Active |
10 | Active |
9 | Active |
8 | Active |
7 | Active |
6 | Active |
5 | Active |
4 | Active |
3 | Active |
2 | Active |
1 | Active |
For Gnome 3.16, diff against v11. Fix Time display reported by madoldman. (Actually a bug in lunar-date, see https://github.com/yetist/lunar-date/pull/1) diff --git a/lunarcal@ailin.nemui/extension.js b/lunarcal@ailin.nemui/extension.js index cd40446..2ceac82 100644 --- a/lunarcal@ailin.nemui/extension.js +++ b/lunarcal@ailin.nemui/extension.js @@ -11,6 +11,10 @@ const LunarDate = imports.gi.LunarDate; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Convenience = Me.imports.convenience; +const Gettext_lunarDate = imports.gettext.domain('lunar-date'); +const _ld = Gettext_lunarDate.gettext; +const diZhi = "Zǐ, Chǒu, Yín, Mǎo, Chén, Sì, Wǔ, Wèi, Shēn, Yǒu, Xū, Hài" + .split(", ").map(function(_){ return _ld(_); }); let replacementFunc = [], ld = new LunarDate.Date, settingsChanged = [], localSettings = {}; let settings; @@ -23,6 +27,10 @@ ld.setDateNoon = function (date) { this.set_solar_date(date.getFullYear(), (1+date.getMonth()), date.getDate(), 12); }; +ld.getShi = function () { + return diZhi[~~((+this.strftime("%(hour)")+1)/2)%12]; +}; + function init() { } @@ -34,7 +42,7 @@ function _make_new_with_args (my_class, args) { function _getLunarClockDisplay() { let show_date = settings.get_boolean('show-date'); return ((show_date ? "\u2001" + ld.strftime("%(YUE)月%(RI)日") : "") + - (settings.get_boolean('show-time') ? ld.strftime(show_date ? "%(SHI)时" : "%(SHI)") : "")); + (settings.get_boolean('show-time') ? ld.getShi() + (show_date ? "时" : "") : "")); }; // avoid replacing WallClock with a custom Object inheriting from