Welcome Guest, Not a member yet? Register   Sign In
Beginner Qs: Nav structure and internationalization
#3

[eluser]rufisgumbo[/eluser]
Thanks I will use the uri language identifier

As for the language class, I did look at that first but thought it was more for defining random words and lines of text that are used commonly throughout the site

You're saying that I could keep my nav how it is but essentially define a new nav_lang file for each language containing translations of all the links? Then I'd need to autoload that and pull in the relevant lines at the controller level and pass to the view?

In past on non-code igniter projects I've setup one class like this

Code:
class Link{
 var $name = array();  
 var $url;
 var $links = array();

 function add_link($links){
    $this->links[] = $links;
  }
}

$all_sections = array();

$section                = new Link();
$section->name['en']    = "Home";
$section->name['fr']]    = "Uberdurky";
$section->url           = "/";

    $sub_section                = new Link();
    $sub_section->name['en']    = "About Acme Ltd";
    $sub_section->name['fr']    = "Fabuka Acme Ltd";
    $sub_section->url           = "/about/";
$section->add_link($sub_section);

Then I have a function to loop through and output the nav, which just looks at the current name[Lang] as defined by session or URL

This actually seems less overhead than having a bunch of Lang files because both the nav structure and translations are defined in one place. But I'm new to CI so I might be misunderstanding the proposed approach... ?


Messages In This Thread
Beginner Qs: Nav structure and internationalization - by El Forum - 05-13-2011, 02:33 AM
Beginner Qs: Nav structure and internationalization - by El Forum - 05-13-2011, 09:34 AM
Beginner Qs: Nav structure and internationalization - by El Forum - 05-13-2011, 02:26 PM
Beginner Qs: Nav structure and internationalization - by El Forum - 05-15-2011, 03:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB