Package com.ecyrd.jspwiki.i18n

Examples of com.ecyrd.jspwiki.i18n.InternationalizationManager


    public void testMessage() throws Exception
    {
        Properties props = new Properties();
        props.load(TestEngine.findTestProperties());
        WikiEngine engine = new TestEngine(props);
        InternationalizationManager i18n = engine.getInternationalizationManager();
        String core = "templates.default";
        Locale english = Locale.ENGLISH;
        Outcome o;

        o = Outcome.DECISION_APPROVE;
        assertEquals("Approve", i18n.get(core, english, o.getMessageKey()));

        o = Outcome.DECISION_DENY;
        assertEquals("Deny", i18n.get(core, english, o.getMessageKey()));

        o = Outcome.DECISION_HOLD;
        assertEquals("Hold", i18n.get(core, english, o.getMessageKey()));

        o = Outcome.DECISION_REASSIGN;
        assertEquals("Reassign", i18n.get(core, english, o.getMessageKey()));
    }
View Full Code Here


     @return A SimpleTimeFormat object which you can use to render
     *  @since 2.8
     */
    public static SimpleDateFormat getDateFormat( WikiContext context, TimeFormat tf )
    {
        InternationalizationManager imgr = context.getEngine().getInternationalizationManager();
        Locale clientLocale = Preferences.getLocale( context );
        String prefTimeZone = Preferences.getPreference( context, "TimeZone" );
        String prefDateFormat;
       
        log.debug("Checking for preferences...");
       
        switch( tf )
        {
            case DATETIME:
                prefDateFormat = Preferences.getPreference( context, "DateFormat" );
                log.debug("Preferences fmt = "+prefDateFormat);
                if( prefDateFormat == null )
                {
                    prefDateFormat = imgr.get( InternationalizationManager.CORE_BUNDLE,
                                               clientLocale,
                                               "common.datetimeformat" );
                    log.debug("Using locale-format = "+prefDateFormat);
                }
                break;
               
            case TIME:
                prefDateFormat = imgr.get( "common.timeformat" );
                break;
               
            case DATE:
                prefDateFormat = imgr.get( "common.dateformat" );
                break;
               
            default:
                throw new InternalWikiException( "Got a TimeFormat for which we have no value!" );
        }
View Full Code Here

TOP

Related Classes of com.ecyrd.jspwiki.i18n.InternationalizationManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.