IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

GWT1.7 + i18n : No resource found for key


Sujet :

GWT et Vaadin Java

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Décembre 2009
    Messages
    7
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2009
    Messages : 7
    Points : 7
    Points
    7
    Par défaut GWT1.7 + i18n : No resource found for key
    Bonjour,
    j'essaie d'intégrer l'internationalisation à une application GWT.

    monPackageClient/utils/i18n/messages_fr.properties
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    food=nourriture
    person=personne
    ...
    (Idem pour messages_en.properties et messages_nl.properties)

    monPackageClient/utils/i18n/Dictionary.java
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    public interface Dictionary extends Constants {
        String food();
        String person();
        ...
    }
    monPackageClient/utils/i18n/MyDictionary.java
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    public class MyDictionary {
        public static Dictionary words = (Dictionary) GWT.create(Dictionary.class);
    }
    monPackageClient/MonEntryPoint.java
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    String str = MyDictionary.words.meal()
    Lors de l'exécution de l'application je capte l'erreur suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    [ERROR] No resource found for key 'person'
    com.google.gwt.i18n.rebind.AbstractResource$MissingResourceException: No resource found for key 'person'
    	at com.google.gwt.i18n.rebind.AbstractResource$ResourceList.getRequiredStringExt(AbstractResource.java:206)
    	at com.google.gwt.i18n.rebind.SimpleValueMethodCreator.createMethodFor(SimpleValueMethodCreator.java:93)
    	at com.google.gwt.i18n.rebind.AbstractLocalizableImplCreator.delegateToCreator(AbstractLocalizableImplCreator.java:307)
    	at com.google.gwt.i18n.rebind.ConstantsImplCreator.emitMethodBody(ConstantsImplCreator.java:160)
    	at com.google.gwt.user.rebind.AbstractGeneratorClassCreator.genMethod(AbstractGeneratorClassCreator.java:263)
    	at com.google.gwt.user.rebind.AbstractGeneratorClassCreator.emitMethods(AbstractGeneratorClassCreator.java:231)
    	at com.google.gwt.user.rebind.AbstractGeneratorClassCreator.emitClass(AbstractGeneratorClassCreator.java:114)
    	at com.google.gwt.i18n.rebind.AbstractLocalizableImplCreator.generateConstantOrMessageClass(AbstractLocalizableImplCreator.java:134)
    	at com.google.gwt.i18n.rebind.LocalizableGenerator.generate(LocalizableGenerator.java:118)
    	at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:49)
    	at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindOracle.java:113)
    	at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:62)
    	at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:172)
    	at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:114)
    	at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:474)
    	at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:365)
    	at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:39)
    	at com.google.gwt.core.client.GWT.create(GWT.java:91)
    	at biz.manex.chbah.crc.web.client.CRC.onModuleLoad(CRC.java:34)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:326)
    	at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:343)
    	at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access$100(BrowserWidgetMoz.java:35)
    	at com.google.gwt.dev.shell.moz.BrowserWidgetMoz$ExternalObjectImpl.gwtOnLoad(BrowserWidgetMoz.java:58)
    	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
    	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1428)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840)
    	at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:264)
    	at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:557)
    	at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
    	at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:105)
    Si quelqu'un a une idée... :-)

  2. #2
    Futur Membre du Club
    Profil pro
    Inscrit en
    Décembre 2009
    Messages
    7
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2009
    Messages : 7
    Points : 7
    Points
    7
    Par défaut
    J'ai trouvé mon erreur :
    • Avant tout j'ai trouvé un site qui disait qu'il faut dans les fichiers properties laisser un espace entre la propriété, le signe '=' et la valeur. Ceci n'a pas résolu mon problème.
    • Le nom de l'interface qui contient les méthodes relatives au propriétés doit correspondre au nom (en respectant la casse) des fichiers properties.



    Par exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    MonInterfaceDictionnaire.java
    -->
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    MonInterfaceDictionnaire.properties
    MonInterfaceDictionnaire_en.properties
    MonInterfaceDictionnaire_nl.properties
    MonInterfaceDictionnaire.properties contient les traductions de la langue par défaut, par exemple le français, si je ne mets pas ce fichier qui ne contient aucun suffixe, j'obtiens toujours mon erreur.

    • On peut définir une autre langue pour la page HTML de 2 façons au moins:


    # Dans l'en-tête de ma page HTML
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <meta name="gwt:property" content="locale=fr">
    # Dans l'URL de la page
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    http://www.monserveur.com/mage.html
    http://www.monserveur.com/mage.html?locale=en
    http://www.monserveur.com/mage.html?locale=nl

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Error 404: Resource not found for the segment
    Par jkamelin dans le forum Microsoft Dynamics CRM
    Réponses: 4
    Dernier message: 07/02/2018, 10h01
  2. Réponses: 3
    Dernier message: 03/06/2014, 16h30
  3. [outil] quid de "max seeks for key" et de "max write
    Par Christophe Charron dans le forum Installation
    Réponses: 2
    Dernier message: 31/03/2006, 06h01
  4. WEB SERVICE No serializer found for class
    Par lch dans le forum XML/XSL et SOAP
    Réponses: 1
    Dernier message: 14/09/2005, 16h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo