test
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • akerman Friend
    #158155

    Hi,

    I’m looking to change the language in the filter-dropdown boxes to the top-right in Admin.

    Selecting “Job Manager” in Admin gives you the dropdown boxes:
    – Please Select Job Type
    – Please Select Location
    – Please Select Category

    The word “Please select” can be found and translated in the normal language “ini” files, but “Job Type…”, Location…”, “Category…” can not and are therefore unaffected by any languagefile.

    I want to find the PHP file responsible for rendering this SELECT/OPTION list and I think I have so in the “Administrator/…/Views/Jajobs/view.html.php” and subsequent the “tmpl/default.php”

    Need some guidance on how to correctly code the language string JText::_(‘JOB TYPE’) in the correct place.

    Regards
    Akerman

    Vinh CV Friend
    #369783

    Dear akerman

    The PHP file process the language translatation in this situation is:

    – componentscom_jajobboardassetrendfield.php
    – With command: JText::_ ( “Please select” . ‘ ‘. strtolower($field->field_name) . ‘…’);

    To translate it to your language, you must include language definition in you language file,

    Example : PLEASE SELECT JOB TYPE…=Please Select Job Type…

    akerman Friend
    #369852

    Hi,

    that would work wonders…if the language tagging was made that way….

    “Please select” – Is the only part that is actually translated, since it is ALREADY present in the language definition file. After it finds that part of the string it dosen’t bother to find the rest.

    Also the rest is controlled by parameter: “strtolower($field->field_name)” (in this case “job_type”)

    So… in order to find a translation for a “field” (not a field value) I need to do something else.
    (…or rendering of this needs to include some intelligence that first identifies fieldnames..before putting them inside JTEXT)

    Suggested solution does not work… sorry.

    Regards
    Akerman

    Vinh CV Friend
    #369945

    <em>@akerman 212454 wrote:</em><blockquote>Hi,

    that would work wonders…if the language tagging was made that way….

    “Please select” – Is the only part that is actually translated, since it is ALREADY present in the language definition file. After it finds that part of the string it dosen’t bother to find the rest.

    Also the rest is controlled by parameter: “strtolower($field->field_name)” (in this case “job_type”)

    So… in order to find a translation for a “field” (not a field value) I need to do something else.
    (…or rendering of this needs to include some intelligence that first identifies fieldnames..before putting them inside JTEXT)

    Suggested solution does not work… sorry.

    Regards
    Akerman</blockquote>

    You can try the following to fix, we have implemented this solution:

    PHP Code:
    sprintf(JText::_ ( “PLEASE SELECT %S…”), JText::_($field->label));

    Language definition:
    PLEASE SELECT %S…=Please select %s…

    akerman Friend
    #370069

    Hi,

    the suggested solution only worked on the first rendered SELECT statement (Job Type) the remaining (Location…) and (Category…) remains unchanged. I suppose that the temporary parameter %S is exhausted after the first loop…

    So.. 33% of the task completed…now only 66% left… :laugh:

    Regards
    Akerman

    Vinh CV Friend
    #370155

    <em>@akerman 212736 wrote:</em><blockquote>Hi,

    the suggested solution only worked on the first rendered SELECT statement (Job Type) the remaining (Location…) and (Category…) remains unchanged. I suppose that the temporary parameter %S is exhausted after the first loop…

    So.. 33% of the task completed…now only 66% left… :laugh:

    Regards
    Akerman</blockquote>

    Please check your Field label and language definition again. We have implemented this and it works.

    let me know, if you are still stuck.

    akerman Friend
    #370261

    Well, the sugested solution works fine – but only for case ‘SELECT’ in function ‘rendfield’. (Job Type)

    Locations and Categories are not treated here – they are handled in function ‘getExternalCombo’

    In addition; this change/similar change has to be done in other places as well in order to reach a multilingual functionality.

    So, here’s the aggreagated solution for those out there who need to change the language in dropdown fields for the Admin – in this example – the “Job manager”

    1)
    In your local language file “xx-YY.com_jajobboard.ini”, as well as your english “en-GB.com_jajobboard.ini” add the following line (Suggest to add ALL new translation at the bottom with a comment on date added. that’s how JA does it and it helps future translation updates since last translation line read is the valid one.):


    PLEASE SELECT %S...=Please select %s...

    2)
    Active file: /administrator/components/com_jajobboard/asset/rendfield.php

    At about line 244 find and change the following in order to alter “Please Select Job Type…:


    // Original $select_options [0]->text = JText::_ ( 'Please select' ).' '.$field->label . '...';
    // Edited ROA Ref: http://www.joomlart.com/forums/topic/admin-filtering-on-job-manager-where-to-change-lanugage/"PLEASE SELECT %S..."), JText::_($field->label));
    else

    $select_options [0]->text = JText::_ ( 'Please select' ). '...';

    3)
    Then in order to change the drop-down filters for “Locations” and “Categories” find the following code and change accordingly at approx. line 319:


    if ($is_filter)

    // Original $objectHTML [] = JHTML::_ ( 'select.option', "", JText::_ ( "Please select" ).' '.$field->label . '...' );
    $objectHTML [] = JHTML::_ ( 'select.option', "", sprintf(JText::_ ( "PLEASE SELECT %S..." ), JText::_($field->label)));
    else

    $objectHTML [] = JHTML::_ ( 'select.option', "", JText::_ ( "Please select" ) . '...' );

    (My comments are only there to make things easier to find in the future… :))

    And as I said, remember that there are more places that probably needs to be changed in the same/similar way in order to reach a solution for translation.

    Happy coding!
    Regards
    Akerman

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

This topic contains 7 replies, has 2 voices, and was last updated by  akerman 13 years, 11 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum