Boost logo

Boost :

Subject: Re: [boost] [locale] Custom Gettext paths.
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2012-08-21 04:52:37

Hello, First of all good job! This this is something that was requested for some time. However I have two points: 1. I'd rather use a single format and not multiple, such that I would use      std::string generator::path_format() const      void generator::path_format(std::string const &);      void generator::set_default_path_format();    Because it makes a complex search that is even today complex even more complex. 2. I'd rather extend the          template<typename CharType>       message_format<CharType> *create_messages_facet(messages_info const &info);     With an additional overload       template<typename CharType>       message_format<CharType> *create_messages_facet(messages_info const &info,std::string const &path_format);     This way it would not affect Boost.Locale's ABI (changing sizeof of messages_info)     3. When you use format          (format(path_formats[k]) % search_paths[i] % paths[j] % lc_cat % domain).str()    It is better to call       (format(path_formats[k]) % search_paths[i] % paths[j] % lc_cat % domain).str(std::locale::classic())    To prevent some problems with global locale or other stuff. Best Regards,   Artyom Beilis -------------- CppCMS - C++ Web Framework: CppDB - C++ SQL Connectivity: ----- Original Message ----- > From: Jookia <166291_at_[hidden]> > To: boost_at_[hidden] > Cc: > Sent: Tuesday, August 21, 2012 5:43 AM > Subject: [boost] [locale] Custom Gettext paths. > > Hello! > > I'm extremely happy about Boost.Locale, but I've found a few things > lacking. So at first I wrote a some wrappers to get around a few flaws with my > usage of Boost.Locale. One of these flaws was how it's hardcoded to use the > Gettext directory hierarchy. > > I'd rather store my stuff in 'lang/' rather than > 'lang/en_US/LC_MESSAGES/'. > > The patch adds a 'path format' feature, which allows you to format the > directory structure when finding Gettext catalogs, to achieve the effect above. > All you really have to do is run: > >   gen.add_path_format("{1}/{2}.mo"); // Use a smaller hierarchy. > > to achieve the result that I prefer, or > >   gen.add_path_format("{1}/{2}/{3}/{4}.mo"); // Use a Gettext > hierarchy. > > to achieve the result that Boost.Locale uses right now. Ripped straight from > Doxygen comments: > >   {1} A path to search for catalogs in. >   {2} The locale's name. >   {3} The locale's category. >   {4} The Gettext domain. > > I'm new to submitting patches and things, and I'm not sure how I could > make this feature better or even acceptable if it isn't already, but I'm > sure it'd help others out there. > > There are a few drawbacks I've found with my code: > > - To be backwards compatible I've had to add some hackery to add the Gettext > format if the path formats vector is empty. > > - Without consulting documentation, the format is unreadable. > > - I haven't tested it on the Win32 backend. I'm 90% sure the code would > work, it's only 4 lines of code added and it's identical to the code > added in the other backends, but it's still untested code. > > - It's not tested properly. By properly, I mean the tests past with adding a > format, and falling back to the default format, but I haven't tried having a > 'compact' format. I'm not sure if this would indicate a fault in the > formatting code though, as that'd be the only difference code-wise, unless > there's more code that has the Gettext hierarchy hardcoded, that didn't > fail when I didn't fix the tests. > > The patch itself is based off of SVN r80097, and despite the diff being for > r80104 I haven't tested it in that.. I did the work internally in Git but I > made the patch using SVN, in case that matters. I've attached the patch, but > I'm not sure how well that's going to go over considering I'm new to > mailing lists, and I'm using.. Thunderbird.. Yeah. In case the attachment > fails, it's available at . I'd also like to know > if it's appropriate to put '[patch]' in the title for any future > patches, and if it should go after '[locale]' or at the end of the > title. > > Thanks, > Jookia. > > > _______________________________________________ > Unsubscribe & other changes: > >

Boost list run by bdawes at, gregod at, cpdaniel at, john at