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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:49:12+00:00 2026-05-12T05:49:12+00:00

ASP.NET MVC app, close to completion, then it was decided that it needed a

  • 0

ASP.NET MVC app, close to completion, then it was decided that it needed a language switcher. It will simply be two languages: English and Japanese. They should be able to switch between the two, but if one is not selected it should choose whichever is the default language of the browser.

I’m wondering what the best solution would be in this case.

First thought, routes! So I change the routes to have a /{l} on the end of every route, and defaulted l = "". Then, in my BaseController (every controller is based off of it), I check the l variable in the route. Each action returns a view based on the language.

I wanted to simply be able to hack /ja-jp on the end of the url, and it would show the view in Japanese. It didn’t quite seem to route correctly. Then, I was real bad in my views and hand coded the links… I couldn’t quite get the helper to output the right links at first… and got into a bad habit of hand coding them. So, I’d have to re-code every link again – to hack the language variable on the end.

Second thought… ok, use jQuery to append the language variable to all anchor’s href. That seems overly clumsy and difficult in certain situations where hrefs are hidden until needed, etc…

So… at this point I’ve decided to just do whatever it takes. What is the most elegant way to switch between 2 languages – without using resource files? I simply want the action to choose between 2 views, based on language.

Do I rewrite every link I’ve got to use the Html helper and then get the routes working? Then in the BaseController just set the language to English if their is no value?

Any advice is much appreciated, thank you.

  • 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-05-12T05:49:13+00:00Added an answer on May 12, 2026 at 5:49 am

    I think one of the most easiest and user-friendly method is to use the domain (sub-domain actually) to identify what language it speaks. It doesn’t need to change almost anything in the Html helper (those HTML.ActionLink) since it works only relatively to domain. Also, it might looks neat to user that when seeing that domain, they know exactly what language it supposed to be, and without making the url too long. All you need to do is to do something in the language switcher to work.

    No matter what approach, I strongly discourage using the second thought, since you can’t deny (even 0.1%) people not having javascript to work to visit your japanese web site, right?

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

Sidebar

Ask A Question

Stats

  • Questions 170k
  • Answers 170k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can either loop on all lines of the array,… May 12, 2026 at 2:07 pm
  • Editorial Team
    Editorial Team added an answer Yes, quite straight forward: Private _name As String Public Property… May 12, 2026 at 2:07 pm
  • Editorial Team
    Editorial Team added an answer A similar question came up on the Twisted mailing list… May 12, 2026 at 2:07 pm

Related Questions

I have an ASP.NET MVC app that opens a Request view in a new
I have ASP.NET MVC Beta on our web server running a few apps. My
We have a web app that is using MVC Preview 3. I'm new to
Remember the little div that shows up at the top of the page to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.