Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

OF and language localisation strings (at runtime)?

$
0
0

@sdaau wrote:

Hi all,

I might have to work with multiple languages in an OF application, so I started looking into string translation for C++ (leaving UTF-8 and other issues aside, let's assume I can use ASCII for everything), and among the first results I got is this:

http://www.boost.org/doc/libs/1_51_0/libs/locale/doc/html/messages_formatting.html

First, our application foo is prepared for localization by calling the translate function for each message used in user interface.

For example: cout << "Hello World" << endl;
Is changed to cout << translate("Hello World") << endl;

Then all messages are extracted from the source code and a special foo.po file is generated that contains all of the original English strings.

... which I find quite usable. However, I am not sure if this works at runtime (that is, the user can click on something, and have the language changed while the application is running) or at compile time (that is, multiple versions of the application can be compiled for different locales/languages); what I need is ability to do a runtime change of strings.

On the other hand, it seems that using Boost in OF was a problem in the past:

https://forum.openframeworks.cc/t/boost-c-libraries/18234

Here (ofxOSXBoost) is the openFrameworks addon for Boost.

... but ofxOSXBoost seems Mac related?!

However, I can see from the compile log of an app compiled with recent pre-0.9 OF:

... -I/path/to/openFrameworks/libs/FreeImage/include -I/path/to/openFrameworks/libs/boost/include -I/path/to/openFrameworks/libs/boost/include/boost -I/path/to/openFrameworks/libs/cairo/include ...

... so it looks like at least a part of boost is already "included" in an OF app build - meaning that I would not need an addon for it?

So I guess this question boils down to these:

  • Is there any default facility in OF for string translation - runtime or compile time?
  • If not, is Boost already part of an openFrameworks build - and if it is, is the locale part of it, or do I need to do something extra to access it?
  • What would you otherwise recommend for string translation in an OF app?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles