Get XOOPS XOOPS FAQ Forums News Themes Modules
News World of XOOPS Developers Hacks Modules Themes Archive Submit News

XOOPS vs. Herko Coomans

Make a donation

Please select an amount to donate


Do you want your username revealed with your donation?
Yes - List me as a Generous Donor
No - List my donation as from an Anonymous Donor


Search

Local Support Sites

Cumulus Tag Cloud

admin Arabic banner block Christmas comments cumulus DayDawn dhsoft e-Commerce E-Learning Google GUI hacks instant-zero jQuery module news Nordic Olédrion oxygen PageRank security SEO simple-XOOPS sport tag Theme wiki xoops

New Users

Registering user

# 96574

audriusr

Welcome to XOOPS!

Archives

XOOPS Code hosted on SourceForge

Language problem with comments

Posted by Zirafka on 2009/11/22 13:30:00 (858 reads) | Posted on Hacks
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


Printer Friendly Page Send this Story to a Friend Create a PDF from the article


Bookmark this article at these sites

                   

The comments are owned by the poster. We aren't responsible for their content.

Nice! In Polish language it's the same problem / situations!
It's great to see it works!
Posted: 2009/11/22 15:21 • Updated: 2009/11/22 16:34
nice hack.

for Slovenian language I have the same problems.

I solve it like this:

Quote:
define("_NW_NUMCOMMENTS"," komentarji: %s"); // 1 - many comments


because, after upgrade of the module, you have to do it over and over again :(
Posted: 2009/11/23 4:34 • Updated: 2009/11/23 4:34
U can use a custom template in your theme. It is not dependig on modules template!
Posted: 2009/11/23 8:46 • Updated: 2009/11/23 8:46
Hack does not interfere with templates, you can use any template and any theme.

Perhaps in the next version of the News included this feature
Posted: 2009/11/23 8:58 • Updated: 2009/11/23 8:58