namespace synfig {
class ChangeLocale {
- const String previous;
- const int category;
+ const String previous;
+ const int category;
public:
- ChangeLocale(int category, const char *locale):
- previous(setlocale(category,locale)),category(category)
- {
- }
- ~ChangeLocale() {
- setlocale(category,previous.c_str());
- }
+ ChangeLocale(int category, const char *locale):
+ // This backups the old locale
+ previous(setlocale(category,NULL)),category(category)
+ {
+ // This effectively changes the locale
+ setlocale(category, locale);
+ }
+ ~ChangeLocale() {
+ // This restores the locale
+ setlocale(category,previous.c_str());
+ }
};
/*! \class ProgressCallback