Comments (7)
I think this should do the job:
std::string get_locale() {
std::string l {"en"};
if (getenv("LANG") != NULL) {
char* env_val = getenv("LANG");
std::string loc(env_val);
if (!loc.empty()) {
if (loc.find("_") != std::string::npos) {
int idx = loc.find_first_of("_");
l = loc.substr(0, idx);
} else {
l = loc;
}
}
}
return l;
}
from nwg-launchers.
Damn, I thought this had been fixed in #63 ...
from nwg-launchers.
check if getenv returns NULL, you can't catch that in an exception
from nwg-launchers.
Yeah, I tested by giving $LANG
an empty string value. Never happened to me to have $LANG
unset.
from nwg-launchers.
You wouldn't find it anyway, because it only happens in freebsd(or linux if you use the same library) because we use a different library for the string class there and it doesn't check if the c string you pass to std::string is NULL when you create one, so we should check it. In linux it checks and throws an std::logic_error.
from nwg-launchers.
2997dc9 works for me:
$ nwggrid
WM: sway
Locale: en
28 .desktop entries found
/home/foo/.config/nwg-launchers/nwggrid/style.css
Focused display: 0, 0, 3840, 2160
Time: 443
from nwg-launchers.
Thanks! Merging, if so.
from nwg-launchers.
Related Issues (20)
- Icons do not break nicely if the requested size is bigger than maximum
- nwggrid broken with multiple displays HOT 8
- Helpful hint for FreeBSD & minimalist DE users. HOT 2
- slow launch time :[ HOT 12
- nwgbar: Better Shorcuts HOT 1
- nwgbar: Class Styling HOT 4
- nwggrid: Add Categories HOT 4
- Graphics glitches in the current git version HOT 2
- screenshots not available (return 404)
- Error when launching programs located in home directory HOT 2
- nwgbar fails to start with default config: -gtk-icon-style is not recognized HOT 3
- version mismatch
- nwggrid does not stick to consistent icon theme HOT 4
- nwggrid: sending signal should hide the window if it's currently visible
- nwggrid: grid.conf is not being found if it's not present in the topmost config directory
- Use emoji in category names by default HOT 1
- "nwggrid-server -no-categories" fails with json exception HOT 1
- Enable setting icon size and column width in JSON config HOT 2
- Set background color via style.css HOT 5
- Can't search by keyword in grid
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nwg-launchers.