|
Boost : |
Subject: Re: [boost] [Locale] Preview of 3rd version
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-09-13 05:01:19
> > >
> > > A. Dictionary source :
> > >
> > > Currently, if I my understanding is correct, the boost::locale library
> > will
> > > always assume that dictionary files are on the (standard?) filesystem.
> >
> >
> > I would be easy to fix.
> >
>
> Great!
>
But as small note, you will have to install dictionaries manually
and not via generator interface.
But rather via this interface:
<http://cppcms.sourceforge.net/boost_locale/html/gnu__gettext_8hpp-source.html>
I mean you'll need to initialize the messages info structure and provide
a callback (that would be member of messages_info)
boost::function<bool(std::string file_name,std::vector<char> &file)>
custom_fs_reader;
And then install the catalogs using:
std::locale new_locale =
std::locale(generated,create_messages_facet<char>(my_message_info));
I don't want to add this into boost::locale::generator, as I don't think this
is generally correct thing to do (as it would require to implement much more
complex path).
> Agreed, I'm already on this path. (After having read your(?) answer on
> StackOverflow some months ago I banished wide strings and made all UTF-8
> based)
Actually it was my question, but I fully agree with the answer :-)
In fact, I did not really want to implement wide strings support for
Boost.Locale, but
I'm afraid that without it, Boost.Locale would not pass the review. Also for
windows development using UTF-16 might be quite justified to simplify the
interaction
with Win32 API.
> > No! Human languages unlike programming are context dependent and ambiguous,
> > same string may be translated into two different strings depending on
> > context.
> >
> > Small but clear example:
> >
> >
> >
>http://cppcms.sourceforge.net/boost_locale/html/tutorial.html#1f0e3dad99908345f7439f8ffabdffc4
>
> >
> >
> I was thinking about more cultural/language based example where there is not
> only context that make the translation hard.
> For example some expressions that exists in some languages don't exists in
> others and just have equivalents that could be used in the given context.
Yes the example is not best.
> So if "domain" are module names, how to differenciate two sentences that are
> the same in a language with two different contextes, but are not the same in
> an other language with the same different contextes?
I don't really understand the question. But maybe this would make it clear:
When you translate a message it is uniquely defined by 4 parameters:
- locale (for example "ru_RU")
- domain (for example "excel")
- context(for example "File Menu")
- id(for example "Open...")
So:
cout << translate("File Menu","Open...")
<< translate("Internet Connection","Open...")
<< translate("Open...")
<< translate("File Menu","Close")
<< translate("Internet Connection","Close")
<< translate("Close")
Require 6 different entries in the dictionary
Artyom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk