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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:29:05+00:00 2026-05-21T23:29:05+00:00

In my applications I make use of Exception(s) to control the flow. I use

  • 0

In my applications I make use of Exception(s) to control the flow.

I use something like this:

throw new Exception("Unable to add new user, user already exist");

This method is perfect in an application with one language. However, when I intend to make a multilingual application, I don’t know what to do.

The previous line of code should produce a message in the default language that the user is using.

What are some possible solutions??

  • 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-21T23:29:05+00:00Added an answer on May 21, 2026 at 11:29 pm

    The general solution is that you have some setting to indicate the current language that the message should be displayed in. Then you have a file or a database table (though this might not be good if messages about database connection errors are stored in the database – you want the error messages as easily accessible as possible – might be best to load them ALL into some cache when the app starts up) somewhere that contains all your error strings, and in multiple languages, such as:

    userExists.English = "Unable to add new user, user already exist"
    userExists.Spanish = "<my Spanish isn't good enough to even try>"
    userExists.ClassicalMongolian = ...
    

    Then when you throw the exception, you have something like

    //currentLanguage indicates what the language of the current session is.
    //the function lookupExceptionString must be able to look up the
    //correct string based on the value of currentLanguage
    exceptionString = lookupExceptionString(currentLanguage);
    throw new Exception(exceptionString );
    

    …But luckily for you there are frameworks that already do a lot of it. Do a web search for “php internationalization”, or “php i18n”, The first link I found was this:

    http://php-flp.sourceforge.net/getting_started_english.htm

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

Sidebar

Related Questions

I've seen some PHP applications use lines of code that are like this: throw
I like to get inspiration from using web applications that make good use of
Web-Applications these days make extensive use of Javascript, for example various Google Products like
I'm new to database applications and I'm trying to use Datamapper to make a
I have several web applications that make use of packages using WebActivator. On my
Are there any sample applications avaliable that make use of both caliburn and prism?
We currently have a number of desktop applications (PowerBuilder, Winforms, WPF) that make use
I currently make Java (eclipse) applications for PC use. Everything from basic standalone programs,
Are there any good applications that people use with the MongoDB database to make
in a Windows Forms Control, I make use of the ThreadExceptionEventHandler where I handle

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.