| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
package org.trails.link; |
| 6 |
|
|
| 7 |
|
import java.util.Locale; |
| 8 |
|
|
| 9 |
|
import org.apache.tapestry.BaseComponent; |
| 10 |
|
import org.apache.tapestry.IRequestCycle; |
| 11 |
|
import org.apache.tapestry.PageRedirectException; |
| 12 |
|
import org.trails.servlet.TrailsApplicationServlet; |
| 13 |
|
|
| 14 |
0 |
public abstract class LocaleLink extends BaseComponent |
| 15 |
|
{ |
| 16 |
|
|
| 17 |
|
public abstract String getLanguage(); |
| 18 |
|
|
| 19 |
|
public abstract String getLinkText(); |
| 20 |
|
|
| 21 |
|
public abstract String getCountry(); |
| 22 |
|
|
| 23 |
|
public void click(IRequestCycle cycle) |
| 24 |
|
{ |
| 25 |
0 |
Locale locale = new Locale(getLanguage(), getCountry()); |
| 26 |
0 |
getPage().getEngine().setLocale(locale); |
| 27 |
0 |
cycle.cleanup(); |
| 28 |
0 |
throw new PageRedirectException(getPage()); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
} |