You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Mattias Engdegård <ma...@bredband.net> on 2013/10/20 12:23:17 UTC

APR_UINT64_FMT_T in localised format strings

Localised strings must consist entirely of literals; they cannot  
contain preprocessor macros. For example, svnserve/serve.c:2234 has

     return svn_error_createf(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                              _("Invalid move_behavior value %"
                                APR_UINT64_T_FMT " in log command"),
                              move_behavior_param);

I suppose the current practice is to format the numbers to separate  
strings and include them using %s in the localised string. (If it were  
up to me, I'd just make %lld (etc) work in all format strings and be  
done with it.)

xgettext complains about (in trunk):

libsvn_fs_x/changes.c:252
libsvn_fs_x/index.c:1228
libsvn_fs_x/noderevs.c:471
libsvn_fs_x/noderevs.c:723
libsvn_fs_x/noderevs.c:733
svnserve/serve.c:2235



Re: APR_UINT64_FMT_T in localised format strings

Posted by Branko Čibej <br...@wandisco.com>.
On 20.10.2013 22:39, Stefan Fuhrmann wrote:
> On Sun, Oct 20, 2013 at 1:51 PM, Branko Čibej <brane@wandisco.com
> <ma...@wandisco.com>> wrote:
>
>     On 20.10.2013 12:23, Mattias Engdegård wrote:
>>     Localised strings must consist entirely of literals; they cannot
>>     contain preprocessor macros. For example, svnserve/serve.c:2234 has
>>
>>         return svn_error_createf(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
>>                                  _("Invalid move_behavior value %"
>>                                    APR_UINT64_T_FMT " in log command"),
>>                                  move_behavior_param);
>>
>>     I suppose the current practice is to format the numbers to
>>     separate strings and include them using %s in the localised string.
>
> Thanks for the report, Mattias!
> Fix committed in r1533970.
>  
>
>     Not at all ... the translator should be free to change the number
>     formatting, so changing them to %s would not be correct, IMO. On
>     the other hand, I can't really think of a better solution, offhand.
>
>
>>     (If it were up to me, I'd just make %lld (etc) work in all format
>>     strings and be done with it.)
>
>     Unfortunately that assumes that %lld is a valid formatting
>     placeholder. That is not the case on all platforms with all compilers.
>
>
> There is a nice double-escapement trick used in other places already.

Ah, good one.

-- Brane


-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com

Re: APR_UINT64_FMT_T in localised format strings

Posted by Stefan Fuhrmann <st...@wandisco.com>.
On Sun, Oct 20, 2013 at 1:51 PM, Branko Čibej <br...@wandisco.com> wrote:

>  On 20.10.2013 12:23, Mattias Engdegård wrote:
>
> Localised strings must consist entirely of literals; they cannot contain
> preprocessor macros. For example, svnserve/serve.c:2234 has
>
>     return svn_error_createf(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
>                              _("Invalid move_behavior value %"
>                                APR_UINT64_T_FMT " in log command"),
>                              move_behavior_param);
>
> I suppose the current practice is to format the numbers to separate
> strings and include them using %s in the localised string.
>
> Thanks for the report, Mattias!
Fix committed in r1533970.


>  Not at all ... the translator should be free to change the number
> formatting, so changing them to %s would not be correct, IMO. On the other
> hand, I can't really think of a better solution, offhand.
>
>
> (If it were up to me, I'd just make %lld (etc) work in all format strings
> and be done with it.)
>
>
> Unfortunately that assumes that %lld is a valid formatting placeholder.
> That is not the case on all platforms with all compilers.
>

There is a nice double-escapement trick used in other places already.

-- Stefan^2.

Re: APR_UINT64_FMT_T in localised format strings

Posted by Branko Čibej <br...@wandisco.com>.
On 20.10.2013 12:23, Mattias Engdegård wrote:
> Localised strings must consist entirely of literals; they cannot
> contain preprocessor macros. For example, svnserve/serve.c:2234 has
>
>     return svn_error_createf(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
>                              _("Invalid move_behavior value %"
>                                APR_UINT64_T_FMT " in log command"),
>                              move_behavior_param);
>
> I suppose the current practice is to format the numbers to separate
> strings and include them using %s in the localised string.

Not at all ... the translator should be free to change the number
formatting, so changing them to %s would not be correct, IMO. On the
other hand, I can't really think of a better solution, offhand.

> (If it were up to me, I'd just make %lld (etc) work in all format
> strings and be done with it.)

Unfortunately that assumes that %lld is a valid formatting placeholder.
That is not the case on all platforms with all compilers.

-- Brane

-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com