On Thu, Oct 19, 2023 at 09:05:38PM +0000, waffl3x wrote: > Okay so taking what you guys are saying here it sounds like it would be > appropriate to refactor the code I was reluctant to refactor. The code > (in grokfndecl) conditionally selects one of the two (now three with my > changes) following strings despite them being mostly identical. > > "non-member function %qD cannot have cv-qualifier" > "static member function %qD cannot have cv-qualifier" > "explicit object member function %qD cannot have cv-qualifier" > > >From what I'm getting from what you two have said is that it would be > reasonable to instead construct a string from it's two parts, just > selecting the differing part dynamically. > > "%s function %qD cannot have cv-qualifier"
No, that wouldn't be appropriate for translation. None of non-member, static member and explicit object member are something that should be printed verbatim untranslated. "%s function %qD cannot have cv-qualifier", _("non-member") etc. is still inappropriate, some language might need to reorder the words in one case and not another one etc. What is ok if that %s (but in that case better %qs) is say some language keyword which shouldn't be translated. "%qs keyword not expected" with the arg being "inline", "constexpr", "consteval" for example would be fine. Jakub