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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:23:50+00:00 2026-06-12T12:23:50+00:00

In the past few days i have be implementing Localization for my web-application written

  • 0

In the past few days i have be implementing Localization for my web-application written in MVC.
There are 3 main task that brake-down the Lozalization “Problem” that I could point out:

  1. Storage: Store Key-Value pair of strings in multiple languages to be used in your application
  2. Server-Side Access: Access the Value according to a given Key in your Server Side Script (e.g. Views, Controllers, Web-forms etc…)
  3. Client-Side Access: Access the Value according to a given Key in your client Side Script (e.g. Java-script)
  4. create a culture switching mechanism.

There are several methods to accomplish each task that I have explored and I’m struggling with choosing between them.
There are two questions that I’m interested in:

  1. I would like to know what would be the best practice for localization? from your point of view.
    Please write Advantages\ Disadvantages for one method vs. the other.
  2. Are there other methods or enhancements that you could suggest.

1. Storage

Resource Files:

  • Store Key-Value pairs of localized strings in a resource file
  • Create a resource file with the same keys for each culture, e.g. myString.resx, myStrings.he-IL.resex etc…

XML Files:

  • Create a structured XML file that will contain a parent node for each key and childe nodes for each culture specific value e.g.

    <string key="myAppName">
        <heIL>some Hebrew value</heIL>
        <enUS>some English value</enUS>
    </string>
    

2. Server Side Access

  • With both Storage options it would be fairly easy to get access to from the server side.
    • Using resource files a bit easier in that case becuse there are classess that are auto-generated to facilitate access to the values. So you use resources as regular clasess with static properties to access each string value according to a key.
    • With XML files you will have to write down the Access Layer code yourself, which is not necessarily a bad thing – because you get much more control that way (only if you need it)

3. Client Side Access

Here is where it gets interesting and sometimes complicated.
There where two options that i have explored here and I’m not sure how to proceed.

Server-Side Generated Script:

  • In your View\ Web-Form add a server script render block inside a <script> tag
  • From this point dynamically create an Array of keys, or static variables in java script and place the required string inside them.
    Here is an example using Razor engine.

       <script type="text/javascript">
                k_CultureInfo = "@CultureInfo.CurrentCulture.Name";
                K_ApplicationName = "@MyStrings.SomeStringKey";
                ....
       </script>
    

Custom HTTP Handler:

I found the idea in a blog pos here: Localize text in JavaScript files in ASP.NET Here

  • Bestially your write an HTTP handler that handles any “.js.axd” request comes to the server.
  • The “ScriptTranslatorHandler” will read the javascrip file and wil replace any instance of a predefined token e.g. Translate(SomeStringKey) in your java script to the correct string taken by any of the methods described above.
  • 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-12T12:23:51+00:00Added an answer on June 12, 2026 at 12:23 pm

    Resource files:

    Use the resx format. Translation tools will not be able to process the format you proposed since it contains multiple languages in the same file. A typical translation tool would take a source file and generate a matching file for each language after translation. I would avoid the format that you suggested at all costs.

    If you want to use an XML, use a single file per language. Also, whatever format you choose, make sure you include context comments for each segment to help translators.

    Server Side Access

    Use the resx and save yourself the time to define the layer

    Client Side Access

    Server side generated script is simpler and more consistent with the sever side access in my opinion.

    Culture switching mechanism

    I assume you are asking about the logic and not the UI. The most common method is to get the user’s browser language setting. If the language is set to a language that does not exist in your application, fall back to your default language. You also want to set a cookie with the users selection (in case they change the language manually) so that they are presented with their language of choice next time.

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

Sidebar

Related Questions

I am learning Python for the past few days and I have written this
There have been several questions over the past few days about the proper use
I have been writing this Android application for the past few days and everything
For past few days I had been working with MVC... I have to show
For the past few days I have been trying to play any sound over
I have been working on learning the Android NDK the past few days, but
I've been using Sublime text 2 for the past few days, and I have
Over the past few days, I have been trying to find an answer to
I have been encountering issues for the past few days with ajaxing in some
I have been trying to set up OpenCV for the past few days with

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.