Skip to content

Commit 5cddd0d

Browse files
committed
util: css: fix locales in css generation
1 parent 5a6f89f commit 5cddd0d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎src/util/css-config.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ CssFromConfigDouble::CssFromConfigDouble(std::string option_name, std::string be
2323
auto cb = [=]
2424
{
2525
std::stringstream ss;
26+
ss.imbue(std::locale::classic());
2627
ss << before << std::to_string(option_value.value()) << after;
2728
std::cout << ss.str() << std::endl;
2829
provider->load_from_string(ss.str());
@@ -55,11 +56,13 @@ CssFromConfigInt::CssFromConfigInt(std::string option_name, std::string css_befo
5556
int value = option_value;
5657
// TODO When we go up to c++20 use std::format
5758
std::stringstream ss;
59+
ss.imbue(std::locale::classic());
5860
ss << css_before << std::to_string(value) << css_after;
5961
provider->load_from_string(ss.str());
6062
});
6163
int value = option_value;
6264
std::stringstream ss;
65+
ss.imbue(std::locale::classic());
6366
ss << css_before << std::to_string(value) << css_after;
6467
provider->load_from_string(ss.str());
6568

@@ -80,6 +83,7 @@ CssFromConfigIconSize::CssFromConfigIconSize(std::string option_name,
8083
}
8184

8285
std::stringstream ss;
86+
ss.imbue(std::locale::classic());
8387
ss << ".wf-panel " << css_class << " {-gtk-icon-size:" << option_value.value() << "px;}";
8488
provider->load_from_string(ss.str());
8589
};
@@ -99,10 +103,12 @@ CssFromConfigString::CssFromConfigString(std::string option_name, std::string cs
99103
{
100104
// TODO When we go up to c++20 use std::format
101105
std::stringstream ss;
106+
ss.imbue(std::locale::classic());
102107
ss << css_before << (std::string)option_value << css_after;
103108
provider->load_from_string(ss.str());
104109
});
105110
std::stringstream ss;
111+
ss.imbue(std::locale::classic());
106112
ss << css_before << (std::string)option_value << css_after;
107113
provider->load_from_string(ss.str());
108114

@@ -146,6 +152,7 @@ void CssFromConfigFont::set_from_string()
146152
}
147153

148154
std::stringstream ss;
155+
ss.imbue(std::locale::classic());
149156
ss << css_before << "font: " << size << unit << " " << before.str() << " " << after.str() << ";" <<
150157
css_after;
151158
auto css = ss.str();
@@ -155,6 +162,7 @@ void CssFromConfigFont::set_from_string()
155162
} else
156163
{
157164
std::stringstream ss;
165+
ss.imbue(std::locale::classic());
158166
ss << css_before << "font: 1rem " << font_name << ";" << css_after;
159167
auto css = ss.str();
160168
provider->load_from_string(css);
@@ -172,6 +180,7 @@ CssFromConfigEdge::CssFromConfigEdge(std::string config_opt, std::string height_
172180
auto callback = [=] ()
173181
{
174182
std::stringstream ss;
183+
ss.imbue(std::locale::classic());
175184
auto position = option_value.value();
176185
if ((position == "top") || (position == "bottom"))
177186
{

0 commit comments

Comments
 (0)