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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:14:52+00:00 2026-06-01T01:14:52+00:00

I was wondering if anyone knows how to get formatted or styled codes from

  • 0

I was wondering if anyone knows how to get formatted or styled codes from the Locale class. What i would like to see is “en_US” for English for US. For example, if i detect a language from Firefox it comes back as “en-us,en;q=0.5”. Later when I want to output it (using getLanguage() or toString()) it comes back as “en-us,en;q=0.5” instead of “en_US”. I tried various functions, but they all seem to return the string that was used to generate the Locale in the first place.

These values go into various UI elements and config files, so it would be nicer to have them looking the same regardless of who or how it was generated and also comparison is not easy when they are converted to strings (have to be).

Cheers and Thanks!

NOTE: I am asking this because we have legacy code that does alot (and i really mean most) of things when data is in string/xml format, so formatting is crucial.

  • 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-01T01:14:53+00:00Added an answer on June 1, 2026 at 1:14 am

    Locale#toString() returns what you want.

    Here’s the thing: the languages you detect from Firefox use the format specified in RFC 2616, which is the HTTP specification. This is a different format from anything you’ll see in a Java Locale because that format is very much HTTP-specific.

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

Sidebar

Related Questions

I was wondering if anyone knows how to get information from an XML file
Just wondering whether anyone knows how to get blogger labels into alt tags in
I know I can get answers here but I was wondering if anyone knows
Wondering if anyone knows a nice way to execute a Java command-line program from
I am just wondering whether anyone knows where I can get a compiled version
Was wondering if anyone knows how to get the historical data for any Facebook
I was wondering if anyone knows how to get a % of say dctest/In
I am just wondering if anyone one knows a method to access/get into an
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
I was wondering if anyone knows of any libraries for programatically creating flash swf

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.