<p>In GWT I have to specify what locales are supported in my application. The code get compiled in various files, one for each locale (beside other versions), but I have to give my clients one only URL. This URL is supposed to be a page that should be displayed according to the locale preferred by the browser.
I dont't want to have an HTTP parameter for the locale since I want to forse the locale preferred by the browser.
How can this be coded in GWT?</p>

<p>Should I try to to this using apache rewrite rules? I thied it, but I think I cannot access such parameter easely in a rewrite rule.</p>

<p>Thanks a lot,
Giuseppe</p>

[{'answer_id': 16769, 'author': 'Michael Sharek', 'author_id': 1958, 'author_profile': 'https://Stackoverflow.com/users/1958', 'pm_score': 2, 'selected': False, 'text': '<p>Unless I am reading the documentation incorrectly I don\'t think you have to do anything.</p>\n\n<p><a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Internationalization.html#SpecifyingLocale" rel="nofollow noreferrer">GWT and Locale</a></p>\n\n<blockquote>\n  <p>By making locale a client property, the standard startup process in gwt.js  chooses the appropriate localized version of an application, providing ease of use (it\'s easier than it might sound!), optimized performance, and minimum script size. </p>\n</blockquote>\n\n<p>The way I read it, as long as your module has added all the locale choices to it, it should be automatic?</p>\n'}, {'answer_id': 40521, 'author': 'Lloyd Meinholz', 'author_id': 4229, 'author_profile': 'https://Stackoverflow.com/users/4229', 'pm_score': 3, 'selected': False, 'text': '<p>GWT has good support for internationalization. See this <a href="http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&amp;s=google-web-toolkit-doc-1-5&amp;t=DevGuideInternationalization" rel="noreferrer">link</a>. The <a href="http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&amp;s=google-web-toolkit-doc-1-5&amp;t=DevGuideI18nCreator" rel="noreferrer">i18nCreator</a> command can help you to set up the internationalization infrastructure for similar to the way projectCreator and applicationCreator set up the GWT application.</p>\n\n<p>If you have static strings (i.e. Invalid Entry!) that need to be internationalized, you don\'t need any additional flag to i18nCreator command to create the properties files and infrastructure.</p>\n\n<p>If you have strings that need to accept parameters (i.e. Hello {0}), you need to pass the -createMessages flag to i18nCreator command to create the properties files and infrastructure.</p>\n\n<p>Now your module needs to include the i18n module in your MyApplication.gwt.xml:</p>\n\n<pre><code>&lt;inherits name="com.google.gwt.i18n.I18N"/&gt;\n</code></pre>\n\n<p>Define a Java interface in the same package as your property files that extends Constants or Messages and defines methods (name matches the property entries) that all return string.</p>\n\n<p>MyConstants.properties contains:</p>\n\n<pre><code>errorMessage=Invalid Entry!\n</code></pre>\n\n<p>MyConstants.java contains:</p>\n\n<pre><code>import com.google.gwt.i18n.client.Constants;\n\npublic interface myConstants extends Constants {\n    String errorMessage();\n}\n</code></pre>\n\n<p>Now to access these internationalized Strings from you application:</p>\n\n<pre><code>public class MyApplication implements EntryPoint {\n    private static final MyConstants constants = (MyConstants)GWT.create(MyConstants.class);\n\n    public void onModuleLoad() {\n        final Label errorMessage = new Label(constants.errorMessage);\n    }\n}\n</code></pre>\n\n<p>GWT implements the interface for you automagically.</p>\n\n<p>You can get messages in a similar way.</p>\n\n<p>Hopefully this can help you get started.</p>\n'}, {'answer_id': 1343216, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': False, 'text': "<p>I had the same problem as you, but as I really need to know the current locale (I'm requesting a second server for data that I want to be localizable) I found this class:\n<code>com.google.gwt.i18n.client.LocaleInfo#getCurrentLocale()</code>. That should give you what GWT uses currently.</p>\n"}, {'answer_id': 4476495, 'author': 'philippe', 'author_id': 546752, 'author_profile': 'https://Stackoverflow.com/users/546752', 'pm_score': 2, 'selected': False, 'text': '<p>Check this com.google.gwt.i18n.client.LocaleInfo.getCurrentLocale()</p>\n'}, {'answer_id': 15151797, 'author': 'Pavel', 'author_id': 1282532, 'author_profile': 'https://Stackoverflow.com/users/1282532', 'pm_score': 2, 'selected': False, 'text': '<pre><code>&lt;inherits name="com.google.gwt.i18n.I18N"/&gt;\n\n&lt;!-- Use browser-specified locale for i18n --&gt;\n&lt;set-configuration-property name="locale.useragent" value="Y"/&gt;\n\n&lt;!-- Specify locales your application support --&gt;\n&lt;extend-property name="locale" values="en"/&gt;\n&lt;extend-property name="locale" values="de_DE"/&gt;\n&lt;extend-property name="locale" values="ru_RU"/&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/16727', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']