Package org.apache.wiki.i18n

Examples of org.apache.wiki.i18n.InternationalizationManager


    public void testMessage() throws Exception
    {
        Properties props = TestEngine.getTestProperties();
        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


     */
    public static ResourceBundle getBundle( WikiContext context, String bundle )
        throws MissingResourceException
    {
        Locale loc = getLocale( context );
        InternationalizationManager i18n = context.getEngine().getInternationalizationManager();
        return i18n.getBundle( bundle, loc );
    }
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 = getLocale( context );
        String prefTimeZone = getPreference( context, "TimeZone" );
        String prefDateFormat;
       
        log.debug("Checking for preferences...");
       
        switch( tf )
        {
            case DATETIME:
                prefDateFormat = 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

            // Send e-mail if user supplied an e-mail address
            if ( profile.getEmail() != null )
            {
                try
                {
                    InternationalizationManager i18n = m_engine.getInternationalizationManager();
                    String app = m_engine.getApplicationName();
                    String to = profile.getEmail();
                    String subject = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc,
                                               "notification.createUserProfile.accept.subject", app );
                   
                    String content = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc,
                                               "notification.createUserProfile.accept.content", app,
                                               profile.getLoginName(),
                                               profile.getFullname(),
                                               profile.getEmail(),
                                               m_engine.getURL( WikiContext.LOGIN, null, null, true ) );
View Full Code Here

    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

     */
    public static ResourceBundle getBundle( WikiContext context, String bundle )
        throws MissingResourceException
    {
        Locale loc = getLocale( context );
        InternationalizationManager i18n = context.getEngine().getInternationalizationManager();
        return i18n.getBundle( bundle, loc );
    }
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 = getLocale( context );
        String prefTimeZone = getPreference( context, "TimeZone" );
        String prefDateFormat;
       
        log.debug("Checking for preferences...");
       
        switch( tf )
        {
            case DATETIME:
                prefDateFormat = 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

            // Send e-mail if user supplied an e-mail address
            if ( profile.getEmail() != null )
            {
                try
                {
                    InternationalizationManager i18n = m_engine.getInternationalizationManager();
                    String app = m_engine.getApplicationName();
                    String to = profile.getEmail();
                    String subject = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc,
                                               "notification.createUserProfile.accept.subject", app );
                   
                    String content = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc,
                                               "notification.createUserProfile.accept.content", app,
                                               profile.getLoginName(),
                                               profile.getFullname(),
                                               profile.getEmail(),
                                               m_engine.getURL( WikiContext.LOGIN, null, null, true ) );
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 org.apache.wiki.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.