1

I'm in process of adding localization to a C++ app. Currently, it has hundreds of texts as string literals scattered all over the (sizeable) code, either printing stuff out, or logging it, or pushing to whichever interface. I'll need to replace great most of them with calls to library functions that replace them with localized versions. (some string literals stay, used as map keys, or such, not subject to localization).

Currently, I'm working with a global search for the double quote mark, " which kinda works, but isn't very comfortable (especially catching all the #includes.)

Is there a more simple, easy approach to finding all the string literals in C++ sources? I'm using Eclipse as my IDE, but light-to-moderate "weight" external tools for Windows would be okay too (I have MinGW and Cygwin, so bash etc commands work too). I'd prefer not to require a different heavyweight IDE like Visual Studio or QT.

SF.
  • 13,549
  • 14
  • 71
  • 107
  • 2
    Possible duplicate of [Searching For String Literals](https://stackoverflow.com/questions/164393/searching-for-string-literals) – Tom Dec 15 '17 at 10:07
  • if some string literals need to stay, then anyhow you need to go through all of them individually, no? – 463035818_is_not_an_ai Dec 15 '17 at 10:07
  • Some IDEs have tools dedicated to internationalization. In particuliar, Qt comes with the excellent Qt Linguist. The operation is still manual, but the tools helps you in presenting you the litteral strings. – Serge Ballesta Dec 15 '17 at 10:17
  • I'm using Eclipse. Is there anything like that in it? Or external tools? I'm not too fond of installing a whole huge other IDE to perform the task. – SF. Dec 15 '17 at 10:28
  • 1
    Run the preprocessor and _then_ use your quotes method. – Ajay Brahmakshatriya Dec 15 '17 at 11:27
  • @SF., just to clarify. Eclipse is just an IDE - a little bit mutated text editor. Qt is a framework, it does not depend on IDE. So technically you may use Qt with your Eclipse-based project. However, Qt itself is in fact quite heavy. – Innokentiy Alaytsev Dec 15 '17 at 11:38
  • @TCouch: Not a duplicate. The linked question is an IDE search, not a programmatic search – MSalters Dec 15 '17 at 13:01
  • @MSalters: I'd be okay with IDE search in Eclipse, but lacking that, programmatic search would work as well. – SF. Dec 15 '17 at 13:14

0 Answers0