I need a way to fetch a string, based on the current language.
Say I have 3 languages: ENGLISH
And I want to display a string representing either Metric
I was thinking maybe an array such I could access as:
would give me the Spanish name for the metric units (of whatever I'm measuring).
But I don't really like that idea. Maybe it's OK.
(If this was .NET code I would look into using Dictionary. But it's unmanaged C++ code.)
Would be nice if all the strings can be initialized in one place. The strings don't change, they're static.
Well so far a 2-D
array of std::wstrings
is the only idea I've come up with. Is there a better way? How would I define a 2-D static array of std::wstrings
and initialize them?
(My other even worse idea was create a whole bunch of strings:
SpanishMetric = "..."
EnglishMetric = "...";
FrenchMetric = "...";
EnglishUS = "...";
SpanishUS = "...";
FrenchUS = "...";
then a nasty case statement:
well that's not nice at all. Very hard to add a language to that mess...
Must be a better way...