locale messages gnu patch 13631

François Dumont francois.cppdevs@free.fr
Fri Jan 7 20:35:00 GMT 2011


On 01/05/2011 10:25 PM, Jonathan Wakely wrote:
> On 5 January 2011 21:09, François Dumont wrote:
>    
>> On 01/03/2011 09:40 PM, Jonathan Wakely wrote:
>>      
>>> On 3 January 2011 20:24, Jonathan Wakely<jwakely.gcc@gmail.com>    wrote:
>>>
>>>        
>>>> On 3 January 2011 20:20, François Dumont wrote:
>>>>
>>>>          
>>>>>     So, anyone can run the test for me ?
>>>>>
>>>>>            
>>>> Sure, I'll try it now.
>>>>
>>>>
>>>>          
>>> a.out: 4.cc:56: void test01(): Assertion `s01 == "secondes"' failed.
>>>
>>> I only have the English catalog for okular
>>>
>>> $ locate okular.mo
>>> /usr/share/locale/en_GB/LC_MESSAGES/okular.mo
>>>
>>> $ locate '*fr*pulseaudio.mo'
>>> /usr/share/locale/fr/LC_MESSAGES/pulseaudio.mo
>>>
>>>
>>>        
>> This is a good first result, we already see that the 2 catalogs have
>> different ids.
>>      
> Should the first VERIFY have failed if I don't have the okular catalog?
>
>    VERIFY( cat_okular>= 0 );
>
>    
>> Could you change the test to target a catalog you have a use
>> an existing entry in this catalog.
>>
>> If you don't have time here is a modified version of the test that will show
>> if at least access to the french catalog of pulse audio is working.
>>      
> a.out: ./4-2.cc:59: void test01(): Assertion `s01 == "secondes" || s02
> == "Serveur de Son PulseAudio"' failed.
>
> I changed it to print out the locale it opens and the translated strings:
>
>    const char ln[] = "de_CH";
>    std::cout<<  ln<<  std::endl;
>    locale loc_fr = locale(ln);
> ...
>    string s01 = mssg_fr.get(cat_okular, 0, 0, "seconds");
>    string s02 = mssg_fr.get(cat_pulseaudio, 0, 0, "PulseAudio Sound Server");
>
>    std::cout<<  s01<<  std::endl;
>    std::cout<<  s02<<  std::endl;
>
> and nothing is being translated:
>
> fr_FR
> seconds
> PulseAudio Sound Server
> a.out: ./4-2.cc:66: void test01(): Assertion `s01 == "secondes" || s02
> == "Serveur de Son PulseAudio"' failed.
> Aborted (core dumped)
>
> I have pulseaudio.mo in fr/LC_MESSAGES not fr_FR/LC_MESSAGES, so in
> case that matters I changed it to use the de_CH locale, as I have
> de_CH/LC_MESSAGES/pulseaudio.mo, but I get the same result:
>
> de_CH
> seconds
> PulseAudio Sound Server
> a.out: ./4-2.cc:66: void test01(): Assertion `s01 == "secondes" || s02
> == "Serveur de Son PulseAudio"' failed.
> Aborted (core dumped)
>
>    
Thanks for your help, I am going to take more time to study the doc or 
code of libintl, I must be missing something...

Francois



More information about the Libstdc++ mailing list