Finally I asked a colleage who is great at php and he kindly provided me with the solution, or workaround if you prefer. This works if, as the title of the menu item, you enter the languaje string code between square brackets [ ] like, for example [mymenu:activity]. For other types of delimiters you'll have to change the first if comparators. Tested and running in elgg 1.12.2 with menu_builder 2.0 downloaded from https://github.com/ColdTrick/menu_builder
Override views/default/navigation/menu/elements/item.php in your module copying the original view to start with, and insert this code at line 36:
if(substr(trim($item->getText()), 0, 1) =='[' && substr(trim($item->getText()), strlen(trim($item->getText()))-1, 1) ==']') {
$del = array('[',']');
$item->setText(elgg_echo( str_replace($del, array(''), trim($item->getText()) ) ) );
}
else {
$pat = '@<a href=\'#\'>\[(.[^\>]*)]@ui';
preg_match($pat, trim($item->getText()), $arr);
if(isset($arr) && is_array($arr) && isset($arr[1])) {
$del = array('[',']');
$item->setText(
str_replace('' . $arr[0], '<a href=\'#\'>' . elgg_echo($arr[1]), $item->getText() )
);
}
}
Then include all your strings in all languajes you like, in your module.
Regards
Fran
Thanks Matt (I'm using your Comment Tracker too :))
I'm adding those lines to the start.php of my modified version of ldap_auth plugin, right after Juho's original line 12:
elgg_register_event_handler('init', 'system', 'ldap_auth_init');
I am running elgg 1.10.2 (up to date as it's not in production yet)
Thanks again
You should put them inside the ldap_auth_init function
Oh my!! I'm such a noob. Thanks a lot. Works perfectly! (and now I understand why, which is better)
Regards
Fran
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.