Hacks

Language problem with comments

Zirafka  22-Nov-2009 17:36 4476 Reads   4 Comment(s) 
The Websites are quite often criticized that the authors of programs or other systems do not consider a different language than their own. So different numbers are displayed correctly in the original language, but in other languages they appear strange.

For example, if the original module is able to distinguish only one or more comments, it's a problem, as the translation results in: "Pocet komentaru: 3" instead of the correct "3 komentare" (Examples are given for the Czech language).

For my server, I adjusted the News module as follows:

File language/YOUR_LANGUAGE/main.php:

define("_NW_NUMCOMMENTS","%s komentare");


change to:

define("_NW_NUMCOMMENTS2","%s komentare"); // 2 - 4 comments
define("_NW_NUMCOMMENTS5","%s komentaru"); // more than 4 comments


File class/class.newsstory.php:

if (XOOPS_COMMENT_APPROVENONE != $xoopsModuleConfig['com_rule'])
{
$ccount $this->comments();
$morelink .= '<a
href="'
.XOOPS_URL.'/modules/news/article.php?storyid='.$this->storyid().'';
$morelink2 '<a
href="'
.XOOPS_URL.'/modules/news/article.php?storyid='.$this->storyid().'';

if ( 
$ccount == )
{
$morelink .= '">'._NW_COMMENTS.'</a>';
}
else
{
if ( 
$fullcount )
{
if ( 
$ccount == )
{
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'">'._NW_ONECOMMENT.'</a>';
}
else
{
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'">';
$morelink .= sprintf(_NW_NUMCOMMENTS$ccount);
$morelink .= '</a>';
}
}
else
{
if ( 
$ccount == )
{
$morelink .= '">'._NW_ONECOMMENT.'</a>';
}
else
{
$morelink .= '">';
$morelink .= sprintf(_NW_NUMCOMMENTS$ccount);
$morelink .= '</a>';
}
}
}
}


change to:

if (XOOPS_COMMENT_APPROVENONE != $xoopsModuleConfig['com_rule'])
{
$ccount $this->comments();
$morelink .= '<a
href="'
.XOOPS_URL.'/modules/news/article.php?storyid='.$this->storyid().'';
$morelink2 '<a
href="'
.XOOPS_URL.'/modules/news/article.php?storyid='.$this->storyid().'';

if ( 
$ccount == )
{
$morelink .= '">'._NW_COMMENTS.'</a>';
}
else
{
if ( 
$fullcount )
{
if ( 
$ccount == )
{
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'">'._NW_ONECOMMENT.'</a>';
}
else
{
if (( 
$ccount >) && ( $ccount <5))
{
$morelink .= '">';
$morelink .= sprintf(_NW_NUMCOMMENTS2$ccount);
$morelink .= '</a>';
}
else
{
$morelink .= '">';
$morelink .= sprintf(_NW_NUMCOMMENTS5$ccount);
$morelink .= '</a>';
}
}
}
else
{
if ( 
$ccount == ) {
$morelink .= '">'._NW_ONECOMMENT.'</a>';
}
else
{
if (( 
$ccount >) && ( $ccount <5))
{
$morelink .= '">';
$morelink .= sprintf(_NW_NUMCOMMENTS2$ccount);
$morelink .= '</a>';
}
else
{
$morelink .= '">';
$morelink .= sprintf(_NW_NUMCOMMENTS5$ccount);
$morelink .= '</a>';
}
}
}
}
}


Modification work will begin immediately, but if you have enabled the cache, it needs to first be erased, otherwise the change will take effect after the flush.

This hack is tested on Xoops 2.4.1 with News module version 1.63

And as always, finally talk about modifying the system: before any treatment can make backup copies of the original files. You never know what can go wrong where.

And that's all

Rating 0/5
Rating: 0/5 (0 votes)
Voting is disabled!


Login

Who's Online

176 user(s) are online (5 user(s) are browsing Publisher)


Members: 0


Guests: 176


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits

Categories