feat: Google IMEと同等の日付変換フォーマットを追加#276
Conversation
「きょう」「きのう」「あした」などの日付変換に以下のフォーマットを追加: - ハイフン区切り(2026-01-12) - ゼロ埋めなし漢字表記(2026年1月12日) - 和暦表記(令和8年1月12日) - 曜日のみ(月曜日) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
早速の反応ありがとうございます。対応します! |
他のIMEとのfeature alignmentを考慮し、ゼロ埋めあり(2026年01月12日)を削除して ゼロ埋めなし(2026年1月12日)のみを採用 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| + [("Gyyyy年M月d日", -18.4)].flatMap { (format, value: PValue) in | ||
| [ | ||
| .init(word: DateTemplateLiteral(format: format, type: .japanese, language: .japanese, delta: "-2", deltaUnit: 60 * 60 * 24).export(), ruby: "オトトイ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .japanese, language: .japanese, delta: "-1", deltaUnit: 60 * 60 * 24).export(), ruby: "キノウ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .japanese, language: .japanese, delta: "0", deltaUnit: 1).export(), ruby: "キョウ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .japanese, language: .japanese, delta: "1", deltaUnit: 60 * 60 * 24).export(), ruby: "アシタ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .japanese, language: .japanese, delta: "2", deltaUnit: 60 * 60 * 24).export(), ruby: "アサッテ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value) | ||
| ] |
There was a problem hiding this comment.
パッと見でなぜ上のflatMapのところに足せないのかわからなかったのですが、どういう意図でしょうか?
There was a problem hiding this comment.
もともとが 令和 の表記を含んだ候補がなくて、令和の表記を出すためには
DateTemplateLiteral で type: .japanese を指定する必要があるので分割しています
There was a problem hiding this comment.
なるほど、理解です!そしたら、CalendarType(でしたっけ)を元のflatMapしてるarray側で明示的に指定する実装にしたいです。繰り返しを避けたいためです。
| + [("E曜日", -18.5)].flatMap { (format, value: PValue) in | ||
| [ | ||
| .init(word: DateTemplateLiteral(format: format, type: .western, language: .japanese, delta: "-2", deltaUnit: 60 * 60 * 24).export(), ruby: "オトトイ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .western, language: .japanese, delta: "-1", deltaUnit: 60 * 60 * 24).export(), ruby: "キノウ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .western, language: .japanese, delta: "0", deltaUnit: 1).export(), ruby: "キョウ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .western, language: .japanese, delta: "1", deltaUnit: 60 * 60 * 24).export(), ruby: "アシタ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value), | ||
| .init(word: DateTemplateLiteral(format: format, type: .western, language: .japanese, delta: "2", deltaUnit: 60 * 60 * 24).export(), ruby: "アサッテ", cid: CIDData.固有名詞.cid, mid: MIDData.一般.mid, value: value) | ||
| ] | ||
| } |
There was a problem hiding this comment.
同じくで、パッと見でなぜ上のflatMapのところに足せないのかわからなかったのですが、どういう意図でしょうか?
There was a problem hiding this comment.
これはまとめる選択肢も問題なく取れると思いました
|
MM/ddとMM月dd日(E)など、他のMM系も他のIMEに寄せたいです |
|
現在対応しているフォーマットは以下で MM/dd → 01/13 MM月dd日(E) のパターンのみが日本語を含みつつ、0埋めになっているので、0埋めをやめたほうが良いように思いました また画像を貼っていただいた変換パーンの中で、R08/01/13 のパターンに関してこちらは追加対応したほうがいいか教えてほしいです |
これはmacOS標準の日本語入力(1枚目)がMM/ddではなくM/ddになってるので合わせようという意図です! R08/01/13は使う人いるのかよくわからないので要望来てからでいいかなと思いました。 |
- 3つのflatMapブロックを1つに統合 - CalendarTypeを配列の要素として明示的に指定 - MM/dd → M/d、MM月dd日(E) → M月d日(E)(ゼロ埋めなし) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
build 通るんですけど、ローカル反映ができずの状態で、PR Open にしちゃいました、すみません |
| [ | ||
| ("M/d", -18, DateTemplateLiteral.CalendarType.western), | ||
| ("yyyy/MM/dd", -18.1, .western), | ||
| ("yyyy-MM-dd", -18.15, .western), |
There was a problem hiding this comment.
ここを-18.15にする意味は特になさそうなので-18.1, -18.2, ... -18.6にしませんか?
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| } | ||
| + [ |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>



Summary
変更内容
Test plan
🤖 Generated with Claude Code