1 / 25

Sakai: Localization & Internationalization

Understand the difference between localization and internationalization in Sakai framework, learn best practices, and implement localization with templates, Java code, and database information.

mstovall
Download Presentation

Sakai: Localization & Internationalization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sakai: Localization & Internationalization Beth Kirschner University of Michigan beth.kirschner@umich.edu

  2. Localization (l10n) versus Internationalization (i18n) • Localization of a web interface is usually limited to isolating the language dependencies such that they can be easily translated. • Internationalization of a web interface takes into account many aspects beyond strict translation of the text, such as cultural differences, space allocation and formatting. • Sakai needs to consider both.

  3. Enabling Sakai Localization • Velocity templates • Java Server Faces templates • Java code • Static HTML (e.g. help text) • Database information

  4. Sakai Presentation Environments Sakai Portal Sakai Velocity Support Layer Sakai JSF Widget Set The Sakai Legacy Environment The Sakai Tool Environment Velocity Templates Java Server Faces in JSP Sakai Framework APIs Sakai Legacy Tools Java Tool Logic Java Beans Sakai Legacy Services Sakai Application Services

  5. Localizing Velocity Templates (before) <form name="viewForm" class="toolbarForm" method="post" action="#toolForm("CalendarAction")"> <input type="hidden" name="eventSubmit_doView" value="view" /> View: <select name="view" size="1" tabindex="3" onchange="blur();document.viewForm.submit();"> #foreach ($view in ["Calendar by day", "Calendar by week", "Calendar by month", "Calendar by year", "List of events"])

  6. Localizing Velocity Templates (after) <form name="viewForm" class="toolbarForm" method="post" action="#toolForm("CalendarAction")"> <input type="hidden" name="eventSubmit_doView" value="view" /> $tlang.getString(“view.view”) <select name="view" size="1" tabindex="3" onchange="blur();document.viewForm.submit();"> #foreach ($view in ["$tlang.getString('java.byday')", "$tlang.getString('java.byweek')", "$tlang.getString('java.bymonth')", "$tlang.getString('java.byyear')", "$tlang.getString('java.listeve')"])

  7. Localizing JSF Templates <f:loadBundle basename="org.sakaiproject.tool.annc.bundle.Messages" var="msgs"/> <f:view> <sakai:view_container title="#{msgs.annc_list_title}"> <h:form> <sakai:tool_bar> <sakai:tool_bar_item action="#{AnnouncementTool.processActionListNew}" value="#{msgs.annc_list_new}" />

  8. Localizing Java Code (before) private static final String STATE_SELECTED_VIEW = "state_selected_view"; private static final String VIEW_BY_DAY = "Calendar by day"; private static final String VIEW_BY_WEEK = "Calendar by week"; private static final String VIEW_BY_MONTH = "Calendar by month"; private static final String VIEW_BY_YEAR = "Calendar by year"; … context.put("selectedView", VIEW_BY_DAY);

  9. Localizing Java Code (after) private static ResourceBundle rb = ResourceBundle.getBundle("calendar") private static final String STATE_SELECTED_VIEW = "state_selected_view"; private static final String VIEW_BY_DAY = rb.getString("java.byday"); private static final String VIEW_BY_WEEK = rb.getString("java.byweek"); private static final String VIEW_BY_MONTH = rb.getString("java.bymonth"); private static final String VIEW_BY_YEAR = rb.getString("java.byyear"); … context.put("selectedView", VIEW_BY_DAY);

  10. Localization Status • Thanks to the developers at University of Lleida, almost every English phrase has been localized into Resource Bundles (almost 4000 separate phrases) • Translation mostly completed in Japanese, Korean and Chinese • Interest has been expressed in Slovokian, Portugese, Catalonia, Spanish, Armenian, Hebrew, …

  11. Korean Chinese Japanese Asian Translations for NEESgrid portal

  12. How to Translate… in 5 easy steps • Ingest properties files into MS Excel Spreadsheet • Translate English Text in spreadsheet • Export into Unicode UTF-16 representation • Convert from UTF-16 into UTF-8 • Ascii-encode UTF-8 representation and save as property file for target language locale (see “I18N and L10N” worksite at http://collab.sakaiproject.org/portal for tips and conversion utilities)

  13. Dynamic Language Detection • What about portals that need to support multiple language locales? • Requirements: • Minimum change to existing code and tools • Use existing ResourceBundle properties files • Simple for users to use • Tatsuki Sugiura at Nagoya University has developed an elegant solution

  14. New ResourceLoader class • New ResourceLoader class replaces java.util.ResourceBundle • ResourceLoader works as a ManagedBean for Java Server Faces (JSF) • ResourceLoader works as a wrapper for ResourceBundle for java and Velocity templates • Language Locale retrieved from HTTP request

  15. Users define language preference in browser (IE, Netscape, Safari, Firefox, …)

  16. ResourceLoader Implementation

  17. Enabling Sakai Internationalization • Page Layout and design • Sentence construction (subject/verb/object) • Timezone differences • Date & Time construction • Definition of a Week • Numbers & Currency • Language dependent sorting • Other culturally dependent data

  18. Page Layouts (skins) • Page layouts can differ for application specific reasons or cultural reasons (e.g. right-to-left languages) • Layout is completely configurable using CSS (Cascading Style Sheets) • Different skins can affect: • Color & Fonts • Icons & Background Images • Layout & Format • Navigation

  19. Skin Directory Structure /library/skin/ tool_base.css /default/ /tool.css /portal.css banner_inst.gif info.gif title.1.gif topleft-tab.gif check.gif linkoff.gif title22.gif topleft-tab_hov.gif headback.gif linkover.gif titleback.gif topright-p-title.gif headmid.gif linksel.gif titleleft.gif warn.gif headright.gif logo_inst.gif titleright.gif help.gif reload.gif topleft-curtab.gif help_h.gif reload_h.gif topleft-p-title.gif /images/ Define your skin here /new-skin/

  20. Sakai Stylesheet Definitions

  21. Right-justified Skins(thanks to Gonzalo Silverio for screenshots)

  22. Page Layout: Space Allocation

  23. What’s not done yet • Problem: Subject/Verb/Object, Subject/Object/Verb, Verb,Subject,Object constructions • Solution: Need to rewrite to use MessageFormat for these compositions • Problem: Timezone differences • Solution: Add timezone option to user preferences and modify affected tools (e.g. Calendar, Chat) • Problem: Date & Time construction • Solution: Java provides date/time constructions specific to language locale -- code needs to be audited for consistent usage

  24. What’s not done yet (continued) • Problem: Definition of a week • Solution: Configuration option needs to be built into Schedule tool • Numbers & Currency • Solution: Java provides number/currency constructions specific to regional locales -- code needs to be audited for consistent usage • Language independent sorting • Solution: Java provides correct unicode string comparisons -- code needs to be audited for consistent usage

  25. Questions?

More Related