Hi Actually locale are made of three elements a language, a country and a variant. Maybe you can set a variant per customer...
2010/7/7 t5_lothar <lothar_n...@gmx.de> > > This approach sounds really promising and works out well for templates. But > how about properties? As the author said, something similiar can be used > for > properties. However, I have difficulties in finding the equivalent... > > > Andreas Pardeike-2 wrote: > > > > On 5 mar 2008, at 06.46, Vjeran Marcinko wrote: > > > >> Anyway, sometimes I deploy my Tapestry application to various > >> customers which want to have dfferent text messages or maybe even > >> outlook of some pages. I can use CSS for some of it, but lets say > >> that I want to pick different page/global .property file for > >> displaying different messages stored in them. > >> > >> Actually, perfect solution for me would be some kindof Locale which > >> could be set initially through Tapestry configuration, so I could > >> have smething like: > >> > >> Home.html > >> Home_customer1.html > >> Home_customer2.html > > > > I would solve this by defining my own PageTemplateLocator (and similar > > for > > properties too). It would need a service 'YourCustomerMode' which > > would be > > inserted into the template constructor: > > > > First, in AppModule.java: > > > > public PageTemplateLocator buildMyPageLocator( > > @ContextProvider AssetFactory contextAssetFactory, > > ComponentClassResolver componentClassResolver, > > YourCustomerMode customer) { > > return new > MyTemplateLocator(contextAssetFactory.getRootResource(), > > componentClassResolver, customer); > > } > > > > public static void contributeAliasOverrides( > > @InjectService("MyPageLocator") PageTemplateLocator locator, > > Configuration<AliasContribution<PageTemplateLocator>> > configuration) { > > > > configuration.add(AliasContribution.create(PageTemplateLocator.class, > > locator)); > > } > > > > and the MyTemplateLocator.java: > > > > public class MyTemplateLocator implements PageTemplateLocator > > { > > private final Resource _contextRoot; > > private final ComponentClassResolver _resolver; > > private final YourCustomerMode _customerMode; > > > > public MyTemplateLocator(Resource contextRoot, > ComponentClassResolver > > resolver, YourCustomerMode customerMode) > > { > > _contextRoot = contextRoot; > > _resolver = resolver; > > _ customerMode = customerMode; > > } > > > > public Resource findPageTemplateResource(ComponentModel model, > Locale > > locale) > > { > > String className = model.getComponentClassName(); > > if(!className.contains(".pages.")) > > return null; > > > > String logicalName = > > _resolver.resolvePageClassNameToPageName(className); > > int slashx = logicalName.lastIndexOf('/'); > > if(slashx > 0) > > { > > String simpleClassName = > InternalUtils.lastTerm(className); > > logicalName = logicalName.substring(0, slashx + 1) > + simpleClassName; > > } > > > > String path = format("%s_%s.html", logicalName, > > _customerMode.getCurrentCustomerName()); > > return _contextRoot.forFile(path).forLocale(locale); > > } > > } > > > > // Andreas Pardeike > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > -- > View this message in context: > http://old.nabble.com/-T5--How-to-%22skin%22-.properties-files--Localization-almost-good...-tp15843698p29098637.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com