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 9275709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:39:05+00:00 2026-06-18T16:39:05+00:00

I have a multiple language website that display several (a dozen) content pages, with

  • 0

I have a multiple language website that display several (a dozen) content pages, with pretty urls like this :

example.com              <- home for default language (french)
example.com/biographie   <- page 1
example.com/en           <- home for english language
example.com/en/biography <- page 1 english translation

I would like to merge pages together and provide full ajax navigation, pretty much like Pitchfork did. And the most important thing is to preserve non-javascript clients (SEO, social networks and others) page view.

The server is providing the complete webpage, and then when Backbone is initialize, it pre-fetches other pages and inject it into the DOM to speed up navigation. When I navigation to another page, I use Backbone builtin History API to record the new URL in the history and I change my view to display the requested page.

var Navigator = Backbone.Router.extend({

  routes: {
    "*page":                "showPage",
  },

  showPage: function(page) {
    this.pages[page].show();
  }

}

The issue I have is to manage i18n (I mean translated pages). How can I setup my router to deal with the language ? How should I handle language switch ?

routes: {
  "*page":                "showPageFr",
  "en/*page":             "showPageEn",
},

showPageFr: function(page){
  showPage(page, 'fr');
},

showPageEn: function(page){
  showPage(page, 'en');
},

showPage: function(page, lang) {
  // How should I manage 'lang' parameter here ?
  this.pages[page].show();
}

I had a look at i18n JS frameworks, but I don’t think I need that because I want to translate the entire page content, not some UI elements. All the translation part is managed server-side.

  • 1 1 Answer
  • 0 Views
  • 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-06-18T16:39:07+00:00Added an answer on June 18, 2026 at 4:39 pm

    Thanks to DashK who drove my on the good road.
    The solution is to change the History root when English language is detected.

    var Router = Backbone.Router.extend({
        language: null,
    
        initialize: function(options){
    
            this.language = options.language;
            Backbone.history.start({pushState: true, root:'/'+ (this.language ? this.language : '')});
        },
    
        routes: {
            ":chapter(/*subpage)": "go",
            "" : "go" // match home route
        },
    
        go: function(chapter, subpage) {
    
        }
    });
    
    // wait for the document to be ready
    $(function(){
        var lang;
        if($.url().segment(1) === 'en') { lang = 'en'; }
    
        new Router({language: lang});
    });
    

    Then, I do not have to care about the language when I use router.navigate("some-chapter") in my code.

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

Sidebar

Related Questions

I have a multiple language website, that uses subdirectories from the root ('/en' for
I have a website that has multiple languages. The way this is set up
I have a website that has multiple languages, currently the language bar is displayed
I have a WordPress website that needs to have its articles in multiple languages.
I have a multiple language website, and I use a php get variable to
I have a multi-language website. I want a module to add multiple version of
I have one website with multiple store views for each language. For some reason
I want to display multiple languages and UI cultures on my website. I have
We have a problem here. We need to translate a website into multiple language.
I have a Kohana 3.0.14 website that i want to put on multiple domains,

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.