Component text localization in IntroJucer


I'm working on localizing my applications by adding the TRANS macros where needed. However, I was surprised to see that the GUI component code that's generated by IntroJucer doesn't allow the text strings to be automatically encapsulated. It's very tedious and error-prone to have to duplicate the exact same text at the end of the constructor just to be able to add in the TRANS macros.

Am I missing something, is there a better way to do this? If not, wouldn't this be good default behavior for the IntroJucer (ie. encapsulate string literals apart from the component name in TRANS macros).

Thanks for the help,


Yes, that's a sensible request.. I doubt if I'll have time to do it soon though, it could be a bit time-consuming to dig through all the code and find all the places where literals are created.

Cool, here's a quick diff I came up with, just looked for applicable matches of quotedString.

What do you think?

(diff in comment below)

Not sure if your diff worked correctly - it seems to be replacing whole files (?)

Oops, forgot to turn off whitespace matching, here it is again.

Thanks for committing an implementation for this request. I'm wondering if it makes sense for component names though. These are never publicly visible, aren't they? Translating them might actually create problems when they're being referred to in code, no?

Yeah, TBH I did a bit of a global search-and-replace without paying too much attention to whether each place made sense. I'll have another look when I get a moment.