Skip to content

Instantly share code, notes, and snippets.

@kabachuha
Created September 20, 2020 21:00
Show Gist options
  • Save kabachuha/10b3ec48a4ef7b99b44c31e6f657b81d to your computer and use it in GitHub Desktop.
Save kabachuha/10b3ec48a4ef7b99b44c31e6f657b81d to your computer and use it in GitHub Desktop.
extract the gettext metadata header from the boost read .mo file bypassing empty string checks
// Should be used when the locale is avaible
template<typename MsgFormat>
std::string get_gettext_meta(const char* domain, std::locale& loc)
{
boost::locale::message_format<char> const* facet = 0;
facet = &std::use_facet<MsgFormat>(loc);
const char* kek = facet->get(facet->domain(domain), NULL, "");
std::string cheburek;
if(kek != NULL) {
cheburek = std::string(kek);
}
return cheburek;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment