1 15 package org.apache.tapestry.junit.mock.c28; 16 17 import java.util.Locale ; 18 import java.util.StringTokenizer ; 19 20 import org.apache.tapestry.IRequestCycle; 21 import org.apache.tapestry.html.BasePage; 22 23 public abstract class Home extends BasePage 24 { 25 public void changeLocale(IRequestCycle cycle, String pageName, String localeName) 26 { 27 String [] localeParts = new String [] 28 { "", "", "" }; 29 StringTokenizer tokenizer = new StringTokenizer (localeName, "_"); 30 for (int i = 0; i < 3 && tokenizer.hasMoreTokens(); i++) 31 { 32 localeParts[i] = tokenizer.nextToken(); 33 } 34 35 Locale locale = new Locale (localeParts[0], localeParts[1], localeParts[2]); 36 cycle.getEngine().setLocale(locale); 37 cycle.activate(pageName); 38 } 39 } | Popular Tags |