Hi Christian,

Thank you for taking time to help. I try to solve my problem using second
approach from your suggestion. Creating LocalizationDispatcher and register
it before PageRender. I try to run my application, it seems rendering wasn't
happened (blank page is returned).

Here is my code snippet.

public class LocalizationDispatcher implements Dispatcher {
    private final PersistentLocale persistentLocale;

    public LocalizationDispatcher(PersistentLocale persistentLocale) {
        this.persistentLocale = persistentLocale;
    }

    public boolean dispatch(Request request, Response response) throws
IOException {
        if (!persistentLocale.isSet()) {
            persistentLocale.set(new Locale("in", "ID"));
        }

        return true;
    }
}

And register it in AppModule here.

public static void
contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configuration) {
    configuration.addInstance("Localization", LocalizationDispatcher.class,
"before:PageRender");
}

What seems to wrong here ?

Thanks,
Rendy.


On Fri, Sep 9, 2011 at 12:26 AM, Christian Köberl <
tapestry.christian.koeb...@gmail.com> wrote:

> 2011-09-08 13:22, Rendy Tapestry:
>
>  Yes, I just set as you do, but it doesn't work. This is because what
>> browser
>> send through request  header is US locale. Based on tapestry mechanism
>> looking up for locale, it will search the nearest locale that is en. That
>> why ordering like that doesn't work.
>>
>> Any other idea ?
>>
>
> Tapestry's best guess is to use the browser's locale - how else to find an
> initial Locale?
>
> You could decorate or replace LocalizationSetter. ComponentEventLinkEncoder
> calls LocalizationSetter#**setLocaleFromLocaleName where you could insert
> your own code returning the default you want.
>
> Another way could be to check PersistentLocale and if not isSet() set your
> own default in a Request dispatcher (before PageRenderDispatcher).
>
> --
> Chris
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to