待辦事項 #43989

Translated counter names

啟用日期: 2022-02-27 01:56 最後更新: 2022-03-03 18:39

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
2

細節

Introduce counter_name_translation() and counter_by_translated_name() functions in common/counter.[ch].

Ticket History (3/9 Histories)

2022-02-27 01:56 Updated by: alienvalkyrie
  • New Ticket "Translated counter names" created
2022-03-01 00:54 Updated by: lachu
評語

I send first version of patch implementing localized/translatable counters.

2022-03-01 03:49 Updated by: alienvalkyrie
評語
  • To initialize a name_translation struct, use the NAME_INIT macro rather than an explicit initializer or compound literal – the internal shape of the structure is not public.
  • In counters_init(), name_set should probably not happen inside the loop – that code will likely change anyway before it becomes relevant, but I'd rather avoid the possibility of accidentally giving multiple different counters the same rule_name.
  • counter_by_rule_name() should use counter_rule_name(), rather than accessing the name struct directly
  • In counters.h, put a /* common */ comment before the include of name_translation.h (also see the "Including Headers" section in doc/CodingStyle, or how includes are structured in other files).
2022-03-01 19:16 Updated by: alienvalkyrie
評語

Also, I just remembered: In order to be translatable, the name should be tagged with the N_() macro – that marks the string, but doesn't translate it (since we don't want to translate the rule name). Also, since the string "Owned" is used in other places, it should be qualified with something like ?counter:, so N_("?counter:Owned").

2022-03-02 01:02 Updated by: lachu
評語

Reply To alienvalkyrie

Also, I just remembered: In order to be translatable, the name should be tagged with the N_() macro – that marks the string, but doesn't translate it (since we don't want to translate the rule name). Also, since the string "Owned" is used in other places, it should be qualified with something like ?counter:, so N_("?counter:Owned").

Ok.

2022-03-02 01:49 Updated by: alienvalkyrie
  • 負責人 Update from (無) to alienvalkyrie
  • 處理結果 Update from to Accepted
評語

Looks good. There are some missing/misplaced blank lines (mostly around counter_by_translated_name()), but I can clean those up (and mention this ticket in the commit message) when merging the patch.

2022-03-03 18:39 Updated by: alienvalkyrie
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

Attachment File List

編輯

Please login to add comment to this ticket » 登入