test
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • roland_web Friend
    #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 Friend
    #530487

    K2 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/

    roland_web Friend
    #530507

    I 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 Friend
    #530514

    I 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.php

    Find 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.ini

    e.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.

    roland_web Friend
    #530731

    It 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 Friend
    #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.

    roland_web Friend
    #530770

    Thanks again for reply. I send you login credentials to PM.

    roland_web Friend
    #530924

    Did you maybe find solution to this problem.

    Thanh Nguyen Viet Friend
    #530925

    I 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.

    roland_web Friend
    #530926

    I send you again login credential of firs level protection. This is additional protection for joomla bots.

    Thanh Nguyen Viet Friend
    #531101

    I 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.

    roland_web Friend
    #531217

    Ok,
    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.

    roland_web Friend
    #531218

    OK,
    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.

    roland_web Friend
    #531308

    I 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.

Viewing 14 posts - 1 through 14 (of 14 total)

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