Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4617102
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:04:39+00:00 2026-05-22T02:04:39+00:00

I’m trying to find the best way of structuring a multi-language site navigation,. I’m

  • 0

I’m trying to find the best way of structuring a multi-language site navigation,.

I’m aware of the language class in CI but it seems to be more for defining random words and lines of text that are used commonly throughout the site. It appears that creating lang files for each language and then defining translations of all the links seems like the standard approach?

In past on non-codeigniter projects I’ve setup one class like this

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 to me seems simpler and less overhead – with the benefit that both the nav structure and translations are defined in one place. But I’m new to CI so I might be misunderstanding the standard approach… ? I’ve googled quite a bit and haven’t seen a solution here in detail.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:04:39+00:00Added an answer on May 22, 2026 at 2:04 am

    The important thing is that it works for you. There are a lot of benefits to using separate language files:

    • Clean separation
    • Only load what you need
    • Easy to keep track of which languages are available
    • Ability to let others easily translate the files

    I don’t see anything wrong with the way you’re doing it, but if you want to optimize – don’t bother defining all the different language lines. You don’t need the French version defined if the language is English. Use only the ones you need, you shouldn’t have to pass the whole array to add_link(), the Link class should be detecting the language and loading the appropriate array only…

    …it’s starting to sound like a language file might be a good idea actually.

    For now you just have French and English. I’m assuming you know both languages and (Uberdurky?) are the only one working on this aspect, so it’s easier for you to define them “inline”. What happens when you want to support 3, 4, or 10 languages? Things will quickly become disorganized and cluttered.

    However, you don’t have to use the Codeigniter Language class, you might be better off using your own system for something like navigation, which tends to be littered with 1 or two word translations, and changes somewhat frequently (either per site or between sites).

    Once again, it’s your call. Do what works best for you now and optimize later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am doing a simple coin flipping experiment for class that involves flipping a
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.