Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reuse Spring or Java's locale lookup code?
    primarykey
    data
    text
    <p>I am doing a Spring web application.</p> <p>I need to support a few locales such as ko (Korean), ru (Russian), en (English), etc. </p> <p>I am able to catch what locale is from a browser via ways such as RequestContextUtils.getLocale(request) or LocaleChangeInterceptor. </p> <p>However, the browser's locale may not be what my web app supports. I have to resolve it to the closet or default locale. </p> <p>Basically, I need to know how to get the resolved locale given the browser's locale AND a few locale values such as ko, ru, and en.</p> <p>My understanding is that Spring has such locale resolution code because it is able to find right resource bundles given a browser's locale. I am hoping to reuse Spring's code for locale resolution, but not sure how to do it. Please note that this question has nothing to do with finding the brwoser's locale or displaying proper messages.</p> <p><strong>EDIT</strong></p> <p>Based on my tracing Spring's code, it appears that Spring depends on JDK to find the exact or closest locale. I just found out this and think this is what I am looking for:</p> <p>Resource Bundle Lookup Order <a href="https://sites.google.com/site/openjdklocale/design-notes/resource-bundle-lookup-order" rel="nofollow">https://sites.google.com/site/openjdklocale/design-notes/resource-bundle-lookup-order</a></p> <p>Please note that I don't need to find right resource bundle. I just need to get the locale the existing JDK code returns given a locale in question and a few known locales. So I am hoping to reuse existing JDK's lookup code. Any idea?</p> <p>I am using JDK 7.</p> <hr> <p>Thanks for any help and input!</p> <p>Regards.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload