Re: Proposal for declinations in gettext



Miloslav Trmac wrote:

>>Or do you mean: is there a way to extract what strings are used to 
>>compose some strings?
>>    
>>
>Yes, and in what declinations. Without that, the traslator can either
>guess or translate up to 7 (or 15) times more than needed.
>  
>
All my comparisons are based on the current state: ATM translator cannot 
even decide to do that kind of extra work, because it would do no good 
(it wouldn't help). This would have to be supported by the programmer.

>>... Again, this kind of work was usually delegated to 
>>programmer, and a requirement is imposed on him to write 
>>"translator-comments" (as in "here, we'll compose string out of...").
>>    
>>
>That's why I'm advocating unified context markers.
>  
>
>>What do you mean by "marking the context 'inline'"?
>>    
>>
>The old "move [card]",  "[move] king"
>  
>
I see. It is a good thing, and I'd like it to be integrated into 
gettext. Yet, it would require of programmers to mark all these as 
separate strings, so it wouldn't work right now (before programmers 
adjust their software).

>>On the *printf() replacement -- ultimately yes, gettext would need to 
>>provide such a replacement. But, how does gettext already handle the 
>>order substitution of parameters in format specifiers (%1$s, %2$s,...)?
>>    
>>
>This is handled by *printf (), as specified by POSIX. Switching
>arguments around is much easier
>
I just checked the ISO C standard first, so this pretty much explains 
why is it easy to do. So, POSIX is what makes it possible (actually, my 
printf(3) says that this is a SUS extension, so it might even not be 
present in POSIX, though I doubt it). Does anyone know of the rationale 
behind this change/extension of C standard? If it's "l10n", then I might 
have a case here :-)

>All printf needs to do is switch the strings around if you specify
>"%2$s %1$s". In order to grok declinations, you'd need either
>	decl_data = gettext_format ("%s %s");
>	param1 = gettext_param (decl_data.param1, "foo");
>	param2 = gettext_param (decl_data.param2, "bar");
>	printf (decl_data.string, param1, param2);
>
>or an extension of printf (), so that
>gettext ("foo") would return mesto;mesta;mestu;.....
>and %5;s would select the fifth entry. 
>
Don't you notice at least a bit of redunancy in here? Some of that could 
be solved using a re#defined printf, and a gettext call which would 
return pointer to array of pointers to char, instead of a pointer to 
char. So, I think most programs would work with just the recompilation. 
Of course, it'd be hard to re#define all *printf calls (many software 
packages introduce their own, like g_strdup_printf), so it'd be better 
just to call the gettext_printf() on the arguments of printf call, 
thereby requiring simple changes in all software that wants to use it.

>Pushing this to libc of all
>operating systems you want to support looks like a big task to me.
>
Nah, it's a simple incompatible change that would break much of 
compliant software. So, I think it would be trivial to force this into 
POSIX and SUS. :-)

Cheers,
Danilo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]