I hope PhocaGallery code change for i18n

Phoca Gallery - image gallery extension
toemon
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 23 Jul 2011, 12:13

I hope PhocaGallery code change for i18n

Post by toemon »

Thanks for a great component.
I'm japanese
First, i appologize to my poor English.

Now,I doing translating japanese language file for PhocaGallery.
Japanese and English are different the syntax.
I hope PhocaGallery code change for i18n


1) For a definition COM_PHOCAGALLERY_FROM
original
com_phocagallery_v3.0.1_beta/libraries/phocagallery/render/renderprocess.php line 70

Code: Select all

echo '<p>' . JText::_('COM_PHOCAGALLERY_GENERATING'). ': <span style="color:#0066cc">'. $currentImg .'</span> '.JText::_('COM_PHOCAGALLERY_FROM'). ' <span style="color:#0066cc">'. $countImg .'</span> '.JText::_('COM_PHOCAGALLERY_THUMBNAIL_S').'</p>';
change to

Code: Select all

echo '<p>' . JText::sprinft('COM_PHOCAGALLERY_GENERATING_FROM_THUMBNAIL_S', '<span style="color:#0066cc">'. $currentImg .'</span> ', ' <span style="color:#0066cc">'. $countImg .'</span> ').'</p>';
adding new language define.
en

Code: Select all

COM_PHOCAGALLERY_GENERATING_FROM_THUMBNAIL_S="Generating %1$s from %2$s Thumbnail(s)"
jp

Code: Select all

COM_PHOCAGALLERY_GENERATING_FROM_THUMBNAIL_S="サムネイル %2$s より %1$s を作成しました"
com_phocagallery_v3.0.1_beta/models/phocagalleryc.php line 664
original

Code: Select all

$countInfo = '<div><b>'.$newStart. '</b> - <b>'. $countImg . '</b> ' .JText::_('COM_PHOCAGALLERY_FROM'). ' <b>' . $album['num'].'</b></div>';
change to

Code: Select all

$countInfo = '<div>'. JText::sprinft('COM_PHOCAGALLERY_FROM_ALBUM' ,'<b>'.$newStart. '</b>', '<b>'. $countImg . '</b> ', ' <b>' . $album['num'].'</b>') .'</div>';
adding new language define.
en

Code: Select all

COM_PHOCAGALLERY_FROM_ALBUM="%1$s - %2$s from %3$s"
jp

Code: Select all

COM_PHOCAGALLERY_FROM_ALBUM="%3$s より %1$s - %2$s"
2) For a definition COM_PHOCAGALLERY_STARS_OUT_OF

com_phocagallery_v3.0.1_beta\site\views\category\tmpl\default_rating.php line 49
original

Code: Select all

echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating='.$i.'&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="'.$i.' '. JText::_('COM_PHOCAGALLERY_STARS_OUT_OF').' 5" class="stars'.$i.'">'.$i.'</a></li>';
change to

Code: Select all

echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating='.$i.'&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="'. JText::sprinft('COM_PHOCAGALLERY_STARS_OUT_OF", $i, 5) .'" class="stars'.$i.'">'.$i.'</a></li>';
com_phocagallery_v3.0.1_beta\site\views\detail\tmpl\default_rating.php line 47
original

Code: Select all

echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating='.$i.'" title="'.$i.' '. JText::_('COM_PHOCAGALLERY_STARS_OUT_OF').' 5" class="stars'.$i.'">'.$i.'</a></li>';
change to

Code: Select all

echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating='.$i.'" title="'.$i.' '. JText::sprinft('COM_PHOCAGALLERY_STARS_OUT_OF", $i, 5). '" class="stars'.$i.'">'.$i.'</a></li>';
change language define.
original

Code: Select all

COM_PHOCAGALLERY_STARS_OUT_OF="stars out of"
change to

Code: Select all

COM_PHOCAGALLERY_STARS_OUT_OF="%1$s stars out of %2$s"
japanese transration e.g

Code: Select all

COM_PHOCAGALLERY_STARS_OUT_OF="%2$sつ星のうちの%1$sつ星"
3) For a definition COM_PHOCAGALLERY_STAR_OUT_OF
com_phocagallery_v3.0.1_beta\site\views\detail\tmpl\default_rating.php line 46
original

Code: Select all

.'<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating=1&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="1 '. JText::_('COM_PHOCAGALLERY_STAR_OUT_OF').' 5" class="star1">1</a></li>';
change to

Code: Select all

.'<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating=1&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="'. JText::sprintf('COM_PHOCAGALLERY_STAR_OUT_OF', 1, 5). '" class="star1">1</a></li>';
com_phocagallery_v3.0.1_beta\site\views\detail\tmpl\default_rating.php line 44
original

Code: Select all

.'<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating=1" title="1 '. JText::_('COM_PHOCAGALLERY_STAR_OUT_OF').' 5" class="star1">1</a></li>';
change to

Code: Select all

.'<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating=1" title="'. JText::sprintf('COM_PHOCAGALLERY_STAR_OUT_OF', 1, 5). '" class="star1">1</a></li>';
change language define.
original

Code: Select all

COM_PHOCAGALLERY_STAR_OUT_OF="star out of"
change to

Code: Select all

COM_PHOCAGALLERY_STAR_OUT_OF="%1$s star out of %2$s"
japanese transration e.g

Code: Select all

COM_PHOCAGALLERY_STAR_OUT_OF="%2$sつ星のうちの%1$sつ星"
thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48694
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: I hope PhocaGallery code change for i18n

Post by Jan »

Hi, thank you for this info (really no idea while creating of component if you cannot test the language :-( )

Yes, it is good idea. I hade some problems with sprinft function in Joomla!

Is the function working properly in Joomla! 1.7?

If yes, I will change it.

Jan
If you find Phoca extensions useful, please support the project
toemon
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 23 Jul 2011, 12:13

Re: I hope PhocaGallery code change for i18n

Post by toemon »

Hi Jan,
Jan wrote: I hade some problems with sprinft function in Joomla!
Is the function working properly in Joomla! 1.7?
I'm sorry I had ​​a spelling mistake.
sprintf is the correct spelling
And there are some syntax errors more.
Therefore, I again presented correct code in the form of Unix Diff.

com_phocagallery_v3.0.1_beta/language/en-GB.com_phocagallery.ini

Code: Select all

11c11,12
< 
---
> COM_PHOCAGALLERY_GENERATING_FROM_THUMBNAIL_S="Generating %1$s from %2$s Thumbnail(s)"
> COM_PHOCAGALLERY_FROM_ALBUM="%1$s - %2$s from %3$s"
77c78
< COM_PHOCAGALLERY_STARS_OUT_OF="stars out of"
---
> COM_PHOCAGALLERY_STARS_OUT_OF="%1$s stars out of %2$s"
1347c1348
< COM_PHOCAGALLERY_STAR_OUT_OF="star out of"
---
> COM_PHOCAGALLERY_STAR_OUT_OF="%1$s star out of %2$s"
com_phocagallery_v3.0.1_beta/libraries/phocagallery/render/renderprocess.php

Code: Select all

71c71
< 			echo '<p>' . JText::_('COM_PHOCAGALLERY_GENERATING'). ': <span style="color:#0066cc">'. $currentImg .'</span> '.JText::_('COM_PHOCAGALLERY_FROM'). ' <span style="color:#0066cc">'. $countImg .'</span> '.JText::_('COM_PHOCAGALLERY_THUMBNAIL_S').'</p>';
---
> 			echo '<p>' . JText::sprintf('COM_PHOCAGALLERY_GENERATING_FROM_THUMBNAIL_S', '<span style="color:#0066cc">'. $currentImg .'</span> ', ' <span style="color:#0066cc">'. $countImg .'</span> ').'</p>';
com_phocagallery_v3.0.1_beta/models/phocagalleryc.php

Code: Select all

664c664
< 								$countInfo 	= '<div><b>'.$newStart. '</b> - <b>'. $countImg . '</b> ' .JText::_('COM_PHOCAGALLERY_FROM'). ' <b>' . $album['num'].'</b></div>';
---
> 								$countInfo = '<div>'. JText::sprintf('COM_PHOCAGALLERY_FROM_ALBUM' ,'<b>'.$newStart. '</b>', '<b>'. $countImg . '</b> ', ' <b>' . $album['num'].'</b>') .'</div>';
com_phocagallery_v3.0.1_beta/site/views/category/tmpl/default_rating.php

Code: Select all

46c46
< 			.'<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating=1&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="1 '. JText::_('COM_PHOCAGALLERY_STAR_OUT_OF').' 5" class="star1">1</a></li>';
---
> 			.'<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating=1&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="'. JText::sprintf('COM_PHOCAGALLERY_STAR_OUT_OF', 1, 5). '" class="star1">1</a></li>';
49c49
< 			echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating='.$i.'&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="'.$i.' '. JText::_('COM_PHOCAGALLERY_STARS_OUT_OF').' 5" class="stars'.$i.'">'.$i.'</a></li>';
---
> 			echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=category&task=rate&rating='.$i.'&tab='.$this->tmpl['currenttab']['rating'].$this->tmpl['limitstarturl'].'" title="'. JText::sprintf('COM_PHOCAGALLERY_STARS_OUT_OF', $i, 5) .'" class="stars'.$i.'">'.$i.'</a></li>';
com_phocagallery_v3.0.1_beta/site/views/detail/tmpl/default_rating.php

Code: Select all

44c44
< 			.'<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating=1" title="1 '. JText::_('COM_PHOCAGALLERY_STAR_OUT_OF').' 5" class="star1">1</a></li>';
---
> 			.'<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating=1" title="'. JText::sprintf('COM_PHOCAGALLERY_STAR_OUT_OF', 1, 5). '" class="star1">1</a></li>';		
47c47
< 			echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating='.$i.'" title="'.$i.' '. JText::_('COM_PHOCAGALLERY_STARS_OUT_OF').' 5" class="stars'.$i.'">'.$i.'</a></li>';
---
> 			echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating='.$i.'" title="'.JText::sprintf('COM_PHOCAGALLERY_STARS_OUT_OF', $i, 5). '" class="stars'.$i.'">'.$i.'</a></li>';
Other (vote,votes)
com_phocagallery_v3.0.1_beta/site/views/detail/view.html.php

Code: Select all

221c221
< 				$this->tmpl['votestextimg'] = 'votes';
---
> 				$this->tmpl['votestextimg'] = 'COM_PHOCAGALLERY_VOTES';
223c223
< 				$this->tmpl['votestextimg'] = 'vote';
---
> 				$this->tmpl['votestextimg'] = 'COM_PHOCAGALLERY_VOTE';
com_phocagallery_v3.0.1_beta/site/views/categories/tmpl/default.php

Code: Select all

203c203
< 				$votesText = 'votes';
---
> 				$votesText = 'COM_PHOCAGALLERY_VOTES';
205c205
< 				$votesText = 'vote';
---
> 				$votesText = 'COM_PHOCAGALLERY_VOTE';
328c328
< 				$votesText = 'votes';
---
> 				$votesText = 'COM_PHOCAGALLERY_VOTES';
330c330
< 				$votesText = 'vote';
---
> 				$votesText = 'COM_PHOCAGALLERY_VOTE';
Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48694
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: I hope PhocaGallery code change for i18n

Post by Jan »

Ok, thank you, Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48694
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: I hope PhocaGallery code change for i18n

Post by Jan »

Changed and fixed in Phoca Gallery 3.0.2
If you find Phoca extensions useful, please support the project
Post Reply