Ticket #43989

Translated counter names

Open Date: 2022-02-27 01:56 Last Update: 2022-03-03 18:39

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
2

Details

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
Comment

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

2022-03-01 03:49 Updated by: alienvalkyrie
Comment
  • 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
Comment

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
Comment

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
  • Owner Update from (None) to alienvalkyrie
  • Resolution Update from None to Accepted
Comment

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
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Attachment File List

Edit

Please login to add comment to this ticket » Login