Alexandre, I had tried this but ran into the issue that the "<replace-with class="xxx">" declaration required a class rather than an interface which is what is used by i18n when utilizing property files. I've seen other approaches where people have used this approach along with a factory but that doesn't appear to work with ui binders where the constants interface is utilized within the ui.xml file.
Did your project use the approach of the constants being referenced directly in the ui.xml file? Thanks, Jeff On Fri, Apr 15, 2011 at 12:03 AM, Alexandre Ardhuin < [email protected]> wrote: > I have something similar in my project. I resolved the problem with > Deferred Binding. > > In HTML page, I can set a js variable : > var profil = "profil1"; > > This js variable will be re-use in Module.gwt.xml to replace default i18n > by a specific one: > <!-- 'profil' property --> > <define-property name="profil" values="profil1,profil2,profil3" /> > <property-provider name="profil"><![CDATA[ > return profil || "profil1"; > ]]></property-provider> > <replace-with class="com.xxx.gwt.i18n.client.I18n"> > <when-type-is class="com.xxx.gwt.i18n.client.profil1.I18n" /> > <when-property-is name="profil" value="profil1" /> > </replace-with> > > Thus, com.xxx.gwt.i18n.client.I18n and com.xxx.gwt.i18n.client.profil1.I18n > can reference differents properties files. > > > Hope this helps, > Alexandre > > > 2011/4/14 Jeff <[email protected]> > >> Does anyone have any experience with how to handle the following >> problem? >> >> My application has multiple user roles, all of which see the same >> screen with the same fields but depending on what role the user comes >> in with, the labels on the fields may differ. I'd like to use an >> approach similar to i18n (constants class backed by various property >> files) where in my use case the role is synonomous with a locale. Note >> that all labels are assigned in UiBinder ui.xml files so the goal is >> something like: >> >> <ui:with field="const" type="com.sample.client.LabelConstants" /> >> >> Where the above declaration should use >> "LabelConstants_registered.properties" or >> "LabelConstants_anonymous.properties" similarly to how i18n would use >> "LabelConstants_en.properties" or "LabelConstants_fr.properties" >> depending on the locale. >> >> Any ideas or experiences? >> >> Thanks in advance. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Web Toolkit" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-web-toolkit?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
