Changing name of Profile Menutabs including capital letters

Gordon S. Posted in Technical Support 4 years ago

I have changed the Link 1 menutab name, and it works fine with one exception. I want the name with the first letter capitalized, and have entered it in the php file that way, but in the website it displays all lower case. Wanted: Media Got: media

How can I change that to what I want, not only in Link 1, but also in Links 2 and 3?

Replies
Catalan Gordon S. Replied 4 years ago

That was an error on my part, in that I had cut and pasted that line, and didn't notice that I had truncated the beginning.

Thank you for your explanation.

German Michael Zülsdorff Replied 4 years ago

No, you can't.
First,

href="http://mywebsite.ca/media.html" title="Media" target="_blank">Media</a>

is NO valid browser instruction. The valid instruction would look like

<a href="http://mywebsite.ca/media.html" title="Media" target="_blank">Media</a>

Next, in my former answer I was trying to explain that the Link's text will be fetched from the language file, thus adding another 'Media' would make no sense at all.

Actually, the function ossn_register_menu_item is NOT a browser instruction itself, instead it assembles given atrributes to a broswer instruction in the end.
In other words: If you want to add extra attributes, you have to add these attributes line by line like

                            'name' => 'link_1',
                            'text' => 'profile:tabs:link1',
                            'href' => 'https://www.google.com',
                            'target' => '_blank',
                            'title' => 'Media',
                            'priority' => 1,
Catalan Gordon S. Replied 4 years ago

A last question about the link1. At present when that link Media is clicked, it goes to that external web page, but in the same window. I want it to open in a new tab (window). As that function is a browser instruction, can I just use regular html for that? It would be:

href="http://mywebsite.ca/media.html" title="Media" target="_blank">Media</a> (note that it is "http and not 'http )

Gordon

Catalan Gordon S. Replied 4 years ago

Thank you -Z-Man for your prompt response. Yes, I am aware that this is a community of individuals, and it was Arsalan who suggested that I post here.

Your answer is letter perfect, and resolves my problem, and I also thank you for that solution.

Gordon

German Michael Zülsdorff Replied 4 years ago

Gordon,
first, allow me to recall that this is no 24/7 support channel but a community of individuals living in different time zones who are trying to help each other in their spare time.

Regarding your question:
All files located in the 'locale' directories - line by line - are containing 'identifiers' in the left column and the actual translations on the right.
That is: your entry 'profile:tabs:link1' => 'Media', is completely correct.
The 'com' file has to reference that identifier like 'text' => 'profile:tabs:link1',
and not another translation. That's what you did wrong.

To summarize:
All you need to change is
a) the right column in the language file
b) and the link in the 'href' => '.....' row.

More details are available on
https://www.opensource-socialnetwork.org/wiki/view/2132/how-to-translate-ossn

Catalan Gordon S. Replied 4 years ago

I repeat, "What code are you referring to?".

Catalan Gordon S. Replied 4 years ago

What code are you referring to? If it is the php file:

<?php
/**
 * Open Source Social Network
 *
 * @package   (softlab24.com).ossn
 * @author    OSSN Core Team <[email protected]>
 * @copyright (C) SOFTLAB24 LIMITED
 * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence
 * @link      https://www.opensource-socialnetwork.org/
 */
function profile_menu_tabs_init() {
    ossn_register_callback('page', 'load:profile', 'profile_menu_tabs');
}
function profile_menu_tabs(){
        $owner = ossn_user_by_guid(ossn_get_page_owner_guid()); //in case you need user profile object
        ossn_register_menu_item('user_timeline', array(
                                'name' => 'Media',
                                'text' => 'Media', //can't use ossn_print directly in user_timeline menu
                                'href' => 'http://www.globalexpo.com/',
                                'priority' => 1,
        ));
        ossn_register_menu_item('user_timeline', array(
                                'name' => 'link_2',
                                'text' => 'profile:tabs:link2', //can't use ossn_print directly in user_timeline menu
                                'href' => 'http://www.google.com/link2',
                                'priority' => 2,
        )); 
        ossn_register_menu_item('user_timeline', array(
                                'name' => 'link_3',
                                'text' => 'profile:tabs:link3', //can't use ossn_print directly in user_timeline menu
                                'href' => 'http://www.google.com/link3',
                                'priority' => 3,
        ));         
}

ossn_register_callback('ossn', 'init', 'profile_menu_tabs_init');

The other php is:

<?php
/**
 * Open Source Social Network
 *
 * @package   Open Source Social Network
 * @author    Open Social Website Core Team <[email protected]>
 * @copyright (C) SOFTLAB24 LIMITED
 * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence
 * @link      https://www.opensource-socialnetwork.org/
 */
$en = array(
    'profile:tabs:link1' => 'Media',
    'profile:tabs:link2' => 'Link 2',
    'profile:tabs:link3' => 'Link 3',
);
ossn_register_languages('en', $en);

.

German Michael Zülsdorff Replied 4 years ago

No idea - please provide your code.