Help with Tapestry i18n

View: New views
2 Messages — Rating Filter:   Alert me  

Help with Tapestry i18n

by Ashwanth Kumar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

People, I've a problem using inbuilt, i18n support of Tapestry (I use
5.0.18). K, When i use persistentLocale and set it to Locale("hi"), hi -
Hindi, its not picking up the page, Home_hi.tml or Home_hi.properties.

Instead, it uses any page like, Home.tml or Home_en.tml

Also, the same problem for the Indic lang., like Locale("ta"), etc.

Is there any workaround for this?? I want my app, to read from the
Home_hi.tml and Home_ta.tml files while creating the markup.

I tired, removing the "en" from the Supported Locales, from the AppModule
Class, also.. My Lines are follows:

public static void contributeApplicationDefaults(
 MappedConfiguration<String, String> configuration) {

 configuration.add(SymbolConstants.SUPPORTED_LOCALES, "ta,hi");
 configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
 }

For, the Home.java, here goes the code:

public class Home {
@Inject
 private PersistentLocale persistentLocale;
 private String locale;

public Home() {
 persistentLocale.set(new Locale("hi")); //
 setLocale(persistentLocale.get().getDisplayName()); // This text displays
the Name as Hindi, but renders the Home_en.tml or Home.tml page only
 }
 /**
 * @param locale the locale to set
 */
 public void setLocale(String locale) {
 this.locale = locale;
 }
 /**
 * @return the locale
 */
 public String getLocale() {
 return locale;
 }
}



Please help me, with the i18n in tapestry plz..

Regards,
Ashwanth Kumar

Re: Help with Tapestry i18n

by Joost Schouten (ml) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You are setting the locale in a constructor of your page. Tapestry will
not call this at page activation. If you place this code in an private
void onActivate() method, you locale should be set for the subsequent
request.

If you upgrade to T5.1, localisation is persisted in the URL by default,
so you could test your pages simply by APP_ROOT/hi/home

Hope it helps,
Joost

Ashwanth Kumar wrote:

> Hey,
>
> People, I've a problem using inbuilt, i18n support of Tapestry (I use
> 5.0.18). K, When i use persistentLocale and set it to Locale("hi"), hi -
> Hindi, its not picking up the page, Home_hi.tml or Home_hi.properties.
>
> Instead, it uses any page like, Home.tml or Home_en.tml
>
> Also, the same problem for the Indic lang., like Locale("ta"), etc.
>
> Is there any workaround for this?? I want my app, to read from the
> Home_hi.tml and Home_ta.tml files while creating the markup.
>
> I tired, removing the "en" from the Supported Locales, from the AppModule
> Class, also.. My Lines are follows:
>
> public static void contributeApplicationDefaults(
>  MappedConfiguration<String, String> configuration) {
>
>  configuration.add(SymbolConstants.SUPPORTED_LOCALES, "ta,hi");
>  configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
>  }
>
> For, the Home.java, here goes the code:
>
> public class Home {
> @Inject
>  private PersistentLocale persistentLocale;
>  private String locale;
>
> public Home() {
>  persistentLocale.set(new Locale("hi")); //
>  setLocale(persistentLocale.get().getDisplayName()); // This text displays
> the Name as Hindi, but renders the Home_en.tml or Home.tml page only
>  }
>  /**
>  * @param locale the locale to set
>  */
>  public void setLocale(String locale) {
>  this.locale = locale;
>  }
>  /**
>  * @return the locale
>  */
>  public String getLocale() {
>  return locale;
>  }
> }
>
>
>
> Please help me, with the i18n in tapestry plz..
>
> Regards,
> Ashwanth Kumar
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...