|
Boost : |
Subject: Re: [boost] [Boost.Locale] Upcoming Boost.Locale version
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-08-24 11:56:16
> Conversion is not an option because an end user would not want to see
> fractional more less oddball numbers such as 241 or 322.
> Because of this an end user would be presented with a different array
> of strings; one that makes more sense in that locale such as
> ["50km", "100km", "150km", "250km"].
Agree, them just use following:
static char const *distances[] = {
NOOP_("50km"),
NOOP_("100km"),
NOOP_("150km"),
NOOP_("250km")
}
cout << tralsate(distances[i]) << endl;
And tranlsator would know how to set these distances
in its own way into something like
"30 miles", "60 miles" etc.
> So what support does your library have for the ICU complex types.
Just to make it clear.
- I don't use ICU for resources translation
- I do not even expose ICU's API to user.
See:
http://cppcms.sourceforge.net/boost_locale/html/tutorial.html#a5bfc9e07964f8dddeb95fc584cd965d
And
http://cppcms.sourceforge.net/boost_locale/html/tutorial.html#19ca14e7ea6328a42e0eb13d585e4c22
So you don't use ICU resources. You rather use GNU Gettext
like catalogs, that have much better tools and much
more popular and much easier to understand by average translator
and developer.
> complex type table of primitive => map<primitive or string or any> or
> any associative collection of primitives, strings, any(s)
> multiple boost ICU serialization archives for more complex
> types capable of generating reading using the ICU api and
> other output and input archive for creating the .txt document
> passed to genrb.exe
No, there are plently of ways to store very complex data
in gettext catalogs. It is a metter taste how to access and
parse them.
Sometimes, simpler solutions are just better.
> http://userguide.icu-project.org/locale/resources
> gave an example of a menu translated/serialized as such
>
> menu {
> id { "mainmenu" }
> items {
> {
> id { "file" }
> name { "&File" }
> items {
> {
> id { "open" }
> name { "&Open" }
> }
> {
> id { "save" }
> name { "&Save" }
> }
> {
> id { "exit" }
> name { "&Exit" }
> }
> }
> }
>
> {
> id { "edit" }
> name { "&Edit" }
> items {
> {
> id { "copy" }
> name { "&Copy" }
> }
> {
> id { "cut" }
> name { "&Cut" }
> }
> {
> id { "paste" }
> name { "&Paste" }
> }
> }
> }
>
> ...
> }
> }
Example for same structure in gettext (context+key):
"Main menu", "&File"
"Main menu->File", "&Open"
"Main menu->File", "&Save"
"Main menu->File", "&Exit"
"Main menu", "&Edit"
"Main menu->Edit", "&Copy"
"Main menu->Edit", "&Cut"
"Main menu->Edit", "&Paste"
Please note, you also get working
English translation for free.
Atyom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk