tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Stärk (JIRA) <j...@apache.org>
Subject [jira] Updated: (TAP5-211) Add localization to translators to allow for localized display/entering of values
Date Wed, 29 Oct 2008 08:50:44 GMT

     [ https://issues.apache.org/jira/browse/TAP5-211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ulrich Stärk updated TAP5-211:
------------------------------

    Attachment: LocalizedTranslatorSource.zip

Here is a localized TranslatorSource and a localized double translator I wrote, configure
them like this in your module:

public static LocalizedTranslatorSource buildLocalizedTranslatorSource(
        @Inject @Symbol("tapestry.supported-locales") final String supportedLocales,
        @InjectService("ThreadLocale") ThreadLocale threadLocale)
{
    HashMap<Locale, Collection<Translator>> configuration = new HashMap<Locale,
Collection<Translator>>();

    for (String locale : supportedLocales.split(","))
    {
        Locale l = new Locale(locale);

        Collection<Translator> s = new HashSet<Translator>();

        s.add(new LocalizedDoubleTranslator(l));
        s.add(new StringTranslator());
        s.add(new ByteTranslator());
        s.add(new IntegerTranslator());
        s.add(new LongTranslator());
        s.add(new FloatTranslator());
        s.add(new ShortTranslator());

        configuration.put(l, s);
    }
    return new LocalizedTranslatorSource(configuration, threadLocale);
}

public static void contributeAliasOverrides(Configuration<AliasContribution> configuration,
        @InjectService("LocalizedTranslatorSource")
        LocalizedTranslatorSource localizedTranslatorSource)
{
    configuration.add(AliasContribution.create(
            TranslatorSource.class,
            localizedTranslatorSource));
}

> Add localization to translators to allow for localized display/entering of values
> ---------------------------------------------------------------------------------
>
>                 Key: TAP5-211
>                 URL: https://issues.apache.org/jira/browse/TAP5-211
>             Project: Tapestry 5
>          Issue Type: Improvement
>    Affects Versions: 5.0.15
>            Reporter: Ulrich Stärk
>            Assignee: Howard M. Lewis Ship
>         Attachments: LocalizedTranslatorSource.zip, TAPESTRY-2457.txt
>
>
> Localization support for pages and messages is great in Tapestry but it lacks support
for localization of input values because the translators don't have support for it. It would
be great if users could just enter numbers etc. in their respective locale, e.g. use ',' instead
of '.' to seperate decimal places from the integer part, out of the box.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message