Using Boost and its pthree
and the .xml or .json parser is a better way.
Equivalence of java.util.ResourceBundle in C++
-
10-06-2023 - |
Question
I have a Java class that uses more lines similar to the following ones
private static final int PARAM_1 = Integer.valueOf(ResourceBundle.getBundle("solution.filtres").getString("filtre.param1.solution"));
private static final int PARAM_2 = Integer.valueOf(ResourceBundle.getBundle("solution.filtres").getString("filtre.param2.solution"));
and the file filtres.properties
found in solution
folder contains:
filtre.param1.solution=1.5
filtre.param2.solution=6
I know that ResourceBundle
is used for user locale, but it seems that it just assigns values to static members from a specific file.
I want to do something similar in C++. I have found this for C++, but it seems a little strange for what it does; so I am asking:
- Is it something similar to ResourceBundle in C++ (not what I have found)? If yes, what, and where can I find some examples?
- Do you advice me to do it in a simpler way?
I would appreciate some code if anyone did some kind of this assignments.
Solution 2
OTHER TIPS
ResourceBundle allows to retrieve textual data for a key, returning a result based on a specified locale. I'm not aware of an exact match for this in C++, but I would like to recommend using GNU gettext() as an option for implementing a similar type of internationalization support.