Opened 10 years ago
Last modified 10 years ago
#7727 new Feature Requests
Gettext information retriever
Reported by: | Owned by: | Artyom Beilis | |
---|---|---|---|
Milestone: | To Be Determined | Component: | locale |
Version: | Severity: | Not Applicable | |
Keywords: | Cc: |
Description
So I figured it'd be nice if we were able to see things about which Gettext catalog is loaded. So I worked up this patch.
The unit test kind of explains how to use it, it's much like locale::info but it requires an object to be created (and deleted by the user, which is a bit shoddy)
If the patch is any good I'm willing to work up some documentation and examples for it.
Attachments (2)
Change History (3)
by , 10 years ago
Attachment: | gettext_info.patch added |
---|
by , 10 years ago
Attachment: | boost-gettext_info.patch added |
---|
comment:1 by , 10 years ago
So this patch uses the catalog_info patch (gettext_paths.patch in #7266) to fill up a catalog_info struct and return it based on what the catalog loads.
Some limitations is that it doesn't return the path to the catalog or anything specific, but it can be used to get in what it gets out.
Here's a snippet of how I use it with a small wrapper I've been using:
blg::catalog_info gettextInfo = blg::get_catalog_info<char>(loc); if(!gettextInfo.domains().empty()) { // There should be a catalog for each domain, and we only allow one domain. SOFT_ASSERT(gettextInfo.domains().size() == 1) { // Do nothing since we'll be indexing the first anyway. } myInfo.translation = gettextInfo.language(); myInfo.domain = gettextInfo.domains()[0].name(); myInfo.path = gettextInfo.paths()[0]; myInfo.format = gettextInfo.path_formats()[0]; }
Patch v1