-
AuthorPosts
-
akerman Friend
akerman
- Join date:
- August 2010
- Posts:
- 31
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 3 times in 1 posts
January 1, 2011 at 11:47 am #158155Hi,
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 CategoryThe 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
AkermanVinh CV FriendVinh CV
- Join date:
- August 2009
- Posts:
- 574
- Downloads:
- 0
- Uploads:
- 2
- Thanked:
- 76 times in 72 posts
January 3, 2011 at 7:52 am #369783Dear 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 Friendakerman
- Join date:
- August 2010
- Posts:
- 31
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 3 times in 1 posts
January 3, 2011 at 3:43 pm #369852Hi,
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
AkermanVinh CV FriendVinh CV
- Join date:
- August 2009
- Posts:
- 574
- Downloads:
- 0
- Uploads:
- 2
- Thanked:
- 76 times in 72 posts
January 4, 2011 at 7:51 am #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 Friendakerman
- Join date:
- August 2010
- Posts:
- 31
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 3 times in 1 posts
January 4, 2011 at 7:29 pm #370069Hi,
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
AkermanVinh CV FriendVinh CV
- Join date:
- August 2009
- Posts:
- 574
- Downloads:
- 0
- Uploads:
- 2
- Thanked:
- 76 times in 72 posts
January 5, 2011 at 6:48 am #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 Friendakerman
- Join date:
- August 2010
- Posts:
- 31
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 3 times in 1 posts
January 5, 2011 at 1:31 pm #370261Well, 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.phpAt 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 -
AuthorPosts
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