File tree 1 file changed +16
-6
lines changed
1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -793,17 +793,30 @@ void PMbrowserWindow::on_actionExport_All_as_IBW_triggered()
793
793
}
794
794
}
795
795
796
+ class locale_manager {
797
+ std::locale old_locale{};
798
+ public:
799
+ void setLocale (const char * name){
800
+ old_locale = std::locale::global (std::locale (name));
801
+ }
802
+ ~locale_manager () {
803
+ std::locale::global (old_locale);
804
+ }
805
+ };
806
+
796
807
void PMbrowserWindow::on_actionExport_Metadata_as_Table_triggered ()
797
808
{
798
809
if (!assertDatFileOpen ()) {
799
810
return ;
800
811
}
801
812
DlgExportMetadata dlg (this );
802
813
if (dlg.exec ()) {
803
- std::locale old_locale ;
814
+ locale_manager lm ;
804
815
if (dlg.useSystemLocale ()) {
805
- std::locale new_locale (" " ); // system default locale
806
- old_locale = std::locale::global (new_locale);
816
+ lm.setLocale (" " ); // set default locale
817
+ }
818
+ else {
819
+ lm.setLocale (" C" );
807
820
}
808
821
auto selected = dlg.getSelection ();
809
822
if (selected < 0 )
@@ -836,9 +849,6 @@ void PMbrowserWindow::on_actionExport_Metadata_as_Table_triggered()
836
849
}
837
850
}
838
851
}
839
- if (dlg.useSystemLocale ()) {
840
- std::locale::global (old_locale);
841
- }
842
852
}
843
853
}
844
854
You can’t perform that action at this time.
0 commit comments