[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: Multiple plural arguments
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2012-10-29 18:02:33
Message-ID: 2165850.KvoMOgSaAJ () xps
[Download RAW message or body]

El Diumenge, 28 d'octubre de 2012, a les 20:19:44, Kevin Krammer va escriure:
> Hi there!
> 
> Over at http://git.reviewboard.kde.org/r/107021/ we are discussing how to
> best handle a case where the non-i18n handling would be a conditional
> concatenation of strings.
> 
> The string would ultimately be something like
> "Comments: 5, Likes: 3"
> or
> "Comments: 5" (no likes
> or
> "Likes: 3" (no comments)
> 
> This is currently done by conditionally appending ", " to the "Comments:
> ..." string if comments and likes exist and then appending "Likes: ..." to
> the result.
> 
> Another option I suggested but which can probably be improved on as well is
> to have three strings, i.e.
> 
> i18n( "Comments: %1" )
> i18n( "Likes: %1" )
> i18n( "Comments: %1, Likes: %2" )
> and then selecting the appropriate one.
> 
> While thinking a bit more about this I came across this variation:
> i18np( "Comment:", "Comments:", numComments )
> i18np( "Like:", "Likes:", numLikes )
> i18nc( "Comment+Like merge pattern", "%1, %2" )
> 
> At this point I decided to go to the experts and ask them :)
> 
> Any thoughts on this?

This is a hard problem, for KLocale and hours + minutes translations we 
"solved" it like your second approach, have a look at 
KLocalePrivate::formatSingleDuration + KLocalePrivate::prettyFormatDuration

Cheers,
  Albert


> 
> Cheers,
> Kevin
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic