Blackboard Bundles - ¿Que language es esta?

If you’re looking for locale globalization in your building blocks then you need to use bundles. Bundles allow you to create property files for each language and then used them throughout your application.

There is a B2Context jar file developed by Stephen Vickers that allows you to easily get the correct language property file and then import it into the pageContext for parsing in your jsp file. But rather than waste time trying to figure it all that out, just look how Michael Fudge does it in the B2 Starter Kit.

<!-- B2-StarterKit\WebContent\system\formdemo.jsp -->
<%
  B2Context b2Context = new B2Context(request);
  String cancelUrl = b2Context.getNavigationItem("admin_plugin_manage").getHref();
  pageContext.setAttribute("bundle", b2Context.getResourceStrings());
  pageContext.setAttribute("cancelUrl", "index.jsp");
  pageContext.setAttribute("thisUrl", "formdemo.jsp");
%>
<bbNG:pageHeader instructions="${bundle['page.system.formdemo.instructions']}">
                <bbNG:breadcrumbBar environment="SYS_ADMIN_PANEL" navItem="admin_plugin_manage">
                <bbNG:breadcrumb href="${cancelUrl}" title="${bundle['plugin.name']}" />
                <bbNG:breadcrumb title="${bundle['page.system.formdemo.breadcrumb']}" />
        </bbNG:breadcrumbBar>
            <bbNG:pageTitleBar iconUrl="${bundle['plugin.logo']}" showIcon="true" showTitleBar="true" title="${bundle['page.system.formdemo.title']}"/>
</bbNG:pageHeader>

Since the locales set is captured by the clients browser it’s good to know your audience. So here is a list of locales you might expect to see coming in, so that you can name your properties correctly that reside in the WEB-INF/bundles directory.

### B2-StarterKit\WebContent\WEB-INF\bundles\bb-manifest-en_US.properties ###
### the location matters ^^ it needs to be in WEB-INF\bundles\ and the name matters too ...
### for example en_US is english and is likely the default bundle
### but the default depends on global Blackboard system settings
### it could very well be the fr_FR if the Blackboard environment is at a French university

...
page.system.formdemo.title=B2SK - Example Form Processing Demo
page.system.formdemo.breadcrumb= Form Demo
page.system.formdemo.instructions=This example demonstrates basic form processing the contents of the form are echoed back to the browser.
page.system.formdemo.step.title=Form Data
page.system.formdemo.step.instructions=Please fill in this form.
page.system.formdemo.label.demoTextelement=demoTextelement:
page.system.formdemo.label.demoRadio=demoRadio:
page.system.formdemo.label.demoCheckbox=demoCheckbox
page.system.formdemo.label.demoSelect=demoSelect:
page.system.formdemo.label.demoDatepicker=demoDatepicker:

...
post by K.D. on 07/10/2012