Need to add plurar options

General questions regarding the use of languages in Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
knalim
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Wed Jan 01, 2014 11:39 pm
Location: SLOVAKIA
Contact:

Need to add plurar options

Post by knalim » Tue Jun 02, 2015 5:59 pm

Hi, I try to have dating site is Slovak and I have subscription for 3,6 and 12 months.
In English is plurar "months" but in Slovak we have to options "mesiace" and mesiacov

I tried to add two lines to sk-SK.com_lovefactory.ini but it didnt work. Could you please help me? THANK YOU

(original line)
COM_LOVEFACTORY_MEMBERSHIPS_PRICE_MONTHS_3="%d mesiace"
(added lines)
COM_LOVEFACTORY_MEMBERSHIPS_PRICE_MONTHS_6="%d mesiacov"
COM_LOVEFACTORY_MEMBERSHIPS_PRICE_MONTHS_12="%d mesiacov"
Joomla amateur but Enthusiast and Lover :)
Attendant of J and Beyond 2015 in Prague
Im beekeeper, I love honey and bees :) http://www.medaren.sk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need to add plurar options

Post by infograf768 » Wed Jun 03, 2015 8:57 am

This depends on the code used to display these strings.
It should be a JText::plural('THE_STRING')

With strings similar to (for English)
COM_MESSAGES_N_ITEMS_DELETED="%d messages successfully deleted."
COM_MESSAGES_N_ITEMS_DELETED_1="Message successfully deleted."

BUT the slovak language pack does not contain the necessary code in
sk-SK.localise.php (site)
It has

Code: Select all

public static function getPluralSuffixes($count)
	{
		if ($count == 0)
		{
			$return = array('0');
		}
		elseif ($count == 1)
		{
			$return = array('1'); 
		}
		else 
		{
			$return = array('MORE');
		}
		return $return;
	}
which means that 3, 6 and 12 are not taken care of.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

knalim
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Wed Jan 01, 2014 11:39 pm
Location: SLOVAKIA
Contact:

Re: Need to add plurar options

Post by knalim » Thu Jun 11, 2015 9:25 pm

Hi Infograf768, I think I understand. Could you please write me, how to change it in the way, that it will work fine for me? THANK YOU
Milan
Joomla amateur but Enthusiast and Lover :)
Attendant of J and Beyond 2015 in Prague
Im beekeeper, I love honey and bees :) http://www.medaren.sk

knalim
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Wed Jan 01, 2014 11:39 pm
Location: SLOVAKIA
Contact:

Re: Need to add plurar options

Post by knalim » Mon Jul 27, 2015 7:55 pm

I tried to change sk-SK.localise.php in following way:

if ($count == 0)
{
$return = array('0');
}
elseif ($count == 1)
{
$return = array('1');
}
else
{
$return = array('3');
}
else
{
$return = array('MORE');
}
return $return;

Parse error: syntax error, unexpected '{', expecting '(' in /home/medaren3/public_html/laskanadzlato.sk/language/sk-SK/sk-SK.localise.php on line 40 - that is line that I added...of course...Could you please help me with correction please?
Joomla amateur but Enthusiast and Lover :)
Attendant of J and Beyond 2015 in Prague
Im beekeeper, I love honey and bees :) http://www.medaren.sk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need to add plurar options

Post by infograf768 » Tue Jul 28, 2015 6:54 am

You can't have 2 else. One has to be an elseif, then the last one will be an else.

What is the condition for 3 ? I guess count==3

In that case the code will be

Code: Select all

	public static function getPluralSuffixes($count)
	{
		if ($count == 0)
		{
			$return = array('0');
		}
		elseif ($count == 1)
		{
			$return = array('1');
		}
		elseif ($count == 3)
		{
			$return = array('3');
		}
		else
		{
			$return = array('MORE');
		}
		return $return;
	}
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

knalim
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Wed Jan 01, 2014 11:39 pm
Location: SLOVAKIA
Contact:

Re: Need to add plurar options

Post by knalim » Tue Jul 28, 2015 7:34 am

Thank you very much infograf768, it worked for me as you wrote the code. THANKS!
Joomla amateur but Enthusiast and Lover :)
Attendant of J and Beyond 2015 in Prague
Im beekeeper, I love honey and bees :) http://www.medaren.sk

knalim
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Wed Jan 01, 2014 11:39 pm
Location: SLOVAKIA
Contact:

Re: Need to add plurar options

Post by knalim » Sun Sep 27, 2015 4:31 pm

Hallo infograf768,

I did write code as you helped me, but If I upgrade my extension, sk-SK.localise.php is rewrited and I have to use your code again. Is it somehow possible to save it in the way, that If I upgrade my extension, changes in sk-SK.localise.php stay as I wrote it.
Thank you very much
Joomla amateur but Enthusiast and Lover :)
Attendant of J and Beyond 2015 in Prague
Im beekeeper, I love honey and bees :) http://www.medaren.sk

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need to add plurar options

Post by infograf768 » Mon Sep 28, 2015 6:50 am

You better contact the sk-SK Translation Coordinator and discuss with him:
http://forum.joomla.org/memberlist.php? ... e&u=341717
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group


Locked

Return to “Language - Joomla! 3.x”