Search code examples
gwtlocale

GWT adding new locales, undefined.cache.js


I have some problems adding new locales to my GWT application.

I currently have two locales added that are working fine, en & sv. However, I can't seem to make it work with any new locales. I have the following in my gwt.xml:

<extend-property name="locale" values="sv"/>
<extend-property name="locale" values="en"/>
<extend-property name="locale" values="fr"/>
<set-property-fallback name="locale" value="en"/>

As well as Constants files for these languages all in the same package as each other named "Constants_fr.properties", "Constants_sv.properties" etc.

This is working fine for en and sv but when I add locale=fr to the URL I get a 404 for "undefined.cache.js", it seems something is not compiling as it should but everything looks the same to me for the locales that are working. Am I missing something here? Any tips or help would be greatly appreciated!


Solution

  • It seems I have found the reason for this so I'll explain what it was in case someone runs in to the same problem.

    I had a module inherit in my gwt.xml which had language support for en & sv. In that module the property was set with:

    <set-property name="locale" value="sv,en" />
    

    This was apperently overriding my own language support since the module inherit line in my gwt.xml was after my own lines for language support like so:

    <extend-property name="locale" values="sv"/>
    <extend-property name="locale" values="en"/>
    <extend-property name="locale" values="fr"/>
    <set-property-fallback name="locale" value="en"/>
    <inherits name='com.example.module'/> //This module only had support for en & sv
    

    To solve this I had to switch the order of these lines in the code so the module inherit was before the language lines. Another solution is to add the line:

    <set-property name="locale" value="sv,en,fr" />
    

    in my gwt.xml after the module inherit.