[curses] ステータスの日本語表示 (Take 2) #26
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
これは元々は issue #21 として投稿したものです。
curses インターフェースでは、状態 (ステータス) 表示をするのに src/botl.c で定義されて
いる valid_conditions[] を参照しています。
コメントにもあるように、この配列は元々ハイライトステータスの設定を
パースするのに使用しているので、これを直接翻訳すると、ハイライト設定に日本語が
混ざるようになってしまいます。
そこで、上記配列からビットマスクを省略した、日本語ステータスだけの配列を
定義して、それを参照するように修正しました。
tty インターフェースでも、重量ステータスで同様の対応をしています (src/botl.c)。
なので、似たようなコメント行を入れてみました。
修正前


修正後
Shift-JIS のファイルを新規に commit / push したのは初めてなのですが、「jnethack-alpha リポジトリは
Shift-JIS のファイルをそのまま commit している」ことに気がつくのにだいぶ遠回りしてしまい、
時間がかかってしまいました。
最初に github の差分表示や編集画面で文字化けしたのは、単に文字コードの自動識別に失敗して
Shift-JIS ではなく iso8859-1 とみなされていた為でした (commit 自体は問題なくされていた)。
自動識別するにはステータス文字列だけでは短かすぎたようで、日本語コメントを 1 行入れたら
Shift-JIS として識別してくれるようになりました。
この差分及び #22 #23 #24 #25 も、FreeBSD 14.3-RELEASE、NetBSD 10.1、Debian 12 で
動作確認しています.
Summary by CodeRabbit
リリースノート
✏️ Tip: You can customize this high-level summary in your review settings.