Component text localization in IntroJucer


#1

Hi,

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,

Geert


#2

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.


#3

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)


#4

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


#5

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


#6

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?


#7

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.