任务单 #43989

Translated counter names

开放日期: 2022-02-27 01:56 最后更新: 2022-03-03 18:39

报告人:
属主:
类型:
状态:
关闭
组件:
里程碑:
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
Fixed
文件:
2

Details

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

任务单历史 (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 Fixed

Attachment File List

编辑

Please login to add comment to this ticket » 登录名