phpnavbarforumpackmybb

MyBB Forum new language Value


I want to add a new language value (English and German) for a navbar. Now I added a new file named navbar.lang.php with this code:

<?php
/**
 * MyBB 1.8 English Language Pack
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 */

$l['navbar_home'] = "Home";
$l['navbar_forum'] = "Forum";
$l['navbar_contact'] = "Contact";
$l['navbar_more'] = "More";
$l['navbar_privacy_policy'] = "Privacy Policy";
$l['navbar_terms_of_use'] = "Terms of Use";
$l['navbar_team_members'] = "Team Members";

?>

then I added in the header template this code:

<a class="active" href="{$mybb->settings['bburl']}"> {$lang->navbar_forum}</a>

But the the a tag is empty and I don't know why. If I look into the page the code looks like this:

<a class="active" href="http://127.0.0.1/forum"></a>

Why is this? If I use another language variable like {$lang->online_online_plural} nothing happens either but I don't know why. I already asked in the MyBB Forum but I didn't get a answer there.


Solution

  • First you nedd to put your nav.lang.php files in the right directory inside the language > english/german. Then open up your index.php then insert this code

    $lang->load('navbar');
    

    after the code

    $lang->load('index');
    

    then your go.

    Note: if you want to show this value in all pages then you should add it in global. Hope it help