-
AuthorPosts
-
April 10, 2014 at 7:54 am #196623
I have problem with multilinguar site, how to translate values in extra fields drop down selection and connect them with items in K2 component.
For instance I have citye – drop down all cities (hot to translate them to another language.Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
April 11, 2014 at 4:07 am #530487K2 does not support multilingual for extra fields, if you want to translate these values, you need to customize some code to get it work.
Please have a look at this thread for reference http://www.joomlart.com/forums/topic/how-can-i-translate-k2-extra-fields/
April 11, 2014 at 7:26 am #530507I am not a PHP programer, How they can make and sell extension JA k2 search if they know that you can not use it in multilingual sites. JA k2 extensions filter products based on extra field values, and they now that you can not translate values. Why they did not write it on description of module before people buy it.
Please I will accept every solution to translate it. Where I must put the code and in which file. Please could you write me the line of code and tell me where I must paste it.Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
April 11, 2014 at 7:53 am #530514I would like to clarify that it is an issue of K2 since it does not support multilingual for extra field. Our component only helps to filter data from what you input for K2.
Below is our suggestion to resolve your issue:
To get the value of extra field from language file instead of database, please open the file:
modules/mod_jak2filter/helper.phpFind the code snippet below:
[PHP]foreach ($values as &$f)
{
if ($field->type == ‘labels’) {
if(!$this->display_counter) {
$num_items = ”;
} elseif($this->update_counter) {
$num_items = $this->getNumItems(‘xfield’, $field->id, 0, $f->value);
} else {
$num_items = $f->num_items;
}
} else {
$num_items = $this->getNumItems(‘xfield’, $field->id, $f->value);
}
$this->bindListData($f, $num_items);
}[/PHP]
And replace it with:[PHP]foreach ($values as &$f)
{
$f->name = JText::_($f->name);
if ($field->type == ‘labels’) {
if(!$this->display_counter) {
$num_items = ”;
} elseif($this->update_counter) {
$num_items = $this->getNumItems(‘xfield’, $field->id, 0, $f->value);
} else {
$num_items = $f->num_items;
}
} else {
$num_items = $this->getNumItems(‘xfield’, $field->id, $f->value);
}
$this->bindListData($f, $num_items);
}[/PHP]You can easily see that a new line added:
[PHP]$f->name = JText::_($f->name);[/PHP]
This code helps to check if the value is defined in language file, it will get that value instead of value from database.One done, you need copy all values of extra field and paste them into language file of JA K2 filter module that located in:
language/en-GB/en-GB.mod_jak2filter.inie.g: If you have extra field type list with options below:
“Standard Job”, “Premium Job”Then you need to declare these values in language file as follows:
STANDARD_JOB = “Standard Job”
PREMIUM_JOB = “Premium Job”Once done for English file, you can clone and translate this file for other languages.
April 13, 2014 at 9:16 pm #530731It works but There are another problems,
1. Now I must write names of values without spaces for example I can not write “Premium Job” I must write “PremiumJob” and then it will translate it.
2. I can not translete names of Extra fields, when I translate them through Joomfish, on translated language will not show drop down list of orginal extra field values. You can see it heare http://kidsactivitiesplus.com/en/component/jak2filter/?isc=1&category_id=7&language=en-GB
Under the drop down selection Activities there is nothing. When you go on default language it show drop down values.I must to finis project, I am late write now and I can not finish it because JA k2 filter does not support more then one language.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
April 14, 2014 at 4:35 am #530756<blockquote>1. Now I must write names of values without spaces for example I can not write “Premium Job” I must write “PremiumJob” and then it will translate it.</blockquote>
Yes, the function: [PHP]JText::_()[/PHP] will convert given string to language key to check if it is defined in language file. And language key only allows alphabet character, number and underscores.<blockquote>2. I can not translete names of Extra fields, when I translate them through Joomfish, on translated language will not show drop down list of orginal extra field values. You can see it heare http://kidsactivitiesplus.com/en/com…language=en-GB
Under the drop down selection Activities there is nothing. When you go on default language it show drop down values. </blockquote>Please PM me your administrator and FTP credentials of your site, I will check to see if I can help you out.
April 14, 2014 at 8:19 am #530770Thanks again for reply. I send you login credentials to PM.
April 15, 2014 at 7:54 am #530924Did you maybe find solution to this problem.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
April 15, 2014 at 7:56 am #530925I can not login your web site back-end since it is protected by htpassword.
I’ve sent you PM to request credentials for this access level, please check your inbox.April 15, 2014 at 8:07 am #530926I send you again login credential of firs level protection. This is additional protection for joomla bots.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
April 16, 2014 at 9:14 am #531101I have checked how K2 works with Joomfish, it requires to add some specifc extra codes in K2 to make it work with Joomfish.
This is not applied in our component for now, since our component only supports translation in native way that is supported from Joomla 2.5+ (specify language for each item by selecting value of language field).I have reported this case to JA K2 Filter development team here for further consideration.
April 17, 2014 at 6:04 am #531217Ok,
please can you tell me is it possible to translate these values in extra fields only through joomla 2.5+. If it is possible can you explain me how to translate these values.April 17, 2014 at 6:08 am #531218OK,
Is possible to translate values in extra fields only through joomla 2.5+ translation capabilities. If it is possible pleas can you explain me how to do this.April 17, 2014 at 6:18 pm #531308I found solution on web only for translation of Extra Field names. Values can be translated through your solution wiht language files.
You just need to put the k2.php file on folder. All explanation is on this page http://code.google.com/p/getk2/issues/detail?id=491
I hope that this solution will help until developers dont fined real and profesional solution. -
AuthorPosts
This topic contains 14 replies, has 2 voices, and was last updated by roland_web 10 years, 7 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum