News:

Wondering if this will always be free?  See why free is better.

Main Menu

(Read 1 times) should be "1 time" ?

Started by kai920, August 10, 2009, 10:16:00 PM

Previous topic - Next topic

kai920

Read 0 times
Read 1 time
Read 2 times

** Should this be changed to (Read 1 time)?

PS. How do other languages beside English handle the 0, 1, and >1 quantities?

JBlaze

/Themes/{your_theme}/Display.template.php
Code (find) Select
<span id="top_subject">', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')</span>
Code (replace) Select
<span id="top_subject">', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', ($context['num_views']) == 1 ? $txt['1time'] : $txt['times'], ')</span>

/Themes/default/languages/Modifications.{yourlang}.php
Code (add at end of file) Select
$txt['1time'] = 'time';
Jason Clemons
Former Team Member 2009 - 2012

kai920

Thanks, probably could have figured out the 'hack' to the default theme, but you saved me a few minutes :)

So, should this "fix" be part of the default theme (Core/Curve)? Does it count as a bug? I would say it does for English, but maybe not for all languages...

JBlaze

Jason Clemons
Former Team Member 2009 - 2012

Sabre™

Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


JBlaze

Jason Clemons
Former Team Member 2009 - 2012

Sabre™

lol
I actually didn't know smf kept members that far inactive.
Learn something everyday :)
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)



Sabre™

Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


karlbenson

FYI, the above bug report has been pushed to 2.1 where we intend to make major improvements with plural vs singular usages.
(per http://dev.simplemachines.org/mantis/view.php?id=3554 )

poolhall

#10
Quote from: karlbenson on August 11, 2009, 01:52:17 PM
FYI, the above bug report has been pushed to 2.1 where we intend to make major improvements with plural vs singular usages.
(per http://dev.simplemachines.org/mantis/view.php?id=3554 )
That's nice to hear. What about other languages? For example, in Russian there could be 3 different forms (cases) for nouns depending of a number, e.g. 10 сообщений (10 messages), 21 сообщение, 33 сообщения. Can SMF in future versions take care of it, or should it be a specific mod?

karlbenson

We have not planned yet on how we implement it, but your example is one of the several reasons why we need a new approach to dealing with them.

I had already raised the issue with the Internationalization team and the deeper we dug, the more complicated it will need to be, so it will definately need some thought and why it won't be for 2.0, but for 2.1

poolhall


SoLoGHoST

#13
Quote from: poolhall on August 12, 2009, 09:05:32 PM
Quote from: karlbenson on August 11, 2009, 01:52:17 PM
FYI, the above bug report has been pushed to 2.1 where we intend to make major improvements with plural vs singular usages.
(per http://dev.simplemachines.org/mantis/view.php?id=3554 )
That's nice to hear. What about other languages? For example, in Russian there could be 3 different forms of numerals, e.g. 10 сообщений (10 messages), 21 сообщение, 33 сообщения. Can SMF in future versions take care of it, or should it be a specific mod?
Reminds me of the time I was trying to convert my ACS Gadget over to Russian as my wife is Russian.  Here was a little function I created to handle all of the various usuages for seconds, minutes, hours, and days.
function doTimeFormat(numStr, whatType)
{
var getLast = numStr.substr(numStr.length - 1);

if ((numStr != "11") && (getLast == "1")) {
if (whatType == "secs")
return " секунду"; // 1 second, minute, hour, day
else if (whatType == "mins")
return " минуту"; // 1 minute
else if (whatType == "hours")
return " час"; // 1 hour
else if (whatType == "days")
return " день"; // 1 day
} else if ( ((numStr != "12") && (numStr != "13") && (numStr != "14")) && ((getLast == "2") || (getLast == "3") || (getLast == "4")) ) {
if (whatType == "secs")
return " секунды"; // 2 seconds, minutes, hours, days...
else if (whatType == "mins")
return " минуты"; // 2 minutes
else if (whatType == "hours")
return " часа"; // 2 hours
else if (whatType == "days")
return " дня"; // 2 days
} else { // 5 seconds, minutes, hours, days - used most
if (whatType == "secs")
return " секунд";
else if (whatType == "mins")
return " минут"; // 5 minutes
else if (whatType == "hours")
return " часов"; // 5 hours
else if (whatType == "days")
return " дней"; // 5 days
}


}


Eventually, my wife got tired of translating all of the words within the gadget, as it has many many words, and some Russian words just wouldn't fit in the space provided.  So we gave up on the idea.  But was a ton of fun working on it anyways.

poolhall

Yeah, it's fun, SoLoGHoST.

I run a bookie on my forum, and this is an example of formula I use in Excel to take care of the work "ставка" (a bet) in Russian:

=IF(OR(RIGHT(X5,1)="0",RIGHT(X5,2)="11",RIGHT(X5,2)="12",RIGHT(X5,2)="13",RIGHT(X5,2)="14",RIGHT(X5,1)>="5"),"ставок",IF(RIGHT(X5,1)="1","ставка",IF(RIGHT(X5,1)<="4","ставки")))

Advertisement: