Sakai: Localization & Internationalization

25
Sakai: Localization & Internationalization Beth Kirschner University of Michigan [email protected]

description

Sakai: Localization & Internationalization. Beth Kirschner University of Michigan [email protected]. Localization (l10n) versus Internationalization (i18n). - PowerPoint PPT Presentation

Transcript of Sakai: Localization & Internationalization

Page 1: Sakai: Localization  & Internationalization

Sakai: Localization & Internationalization

Beth KirschnerUniversity of Michigan

[email protected]

Page 2: Sakai: Localization  & Internationalization

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.

Page 3: Sakai: Localization  & Internationalization

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

Page 4: Sakai: Localization  & Internationalization

Java ServerFaces in JSP

Java Tool LogicJava Beans

Sakai ApplicationServices

Sakai JSFWidget Set

The

Sak

ai T

ool E

nviro

nmen

t

VelocityTemplates

Sakai LegacyTools

Sakai LegacyServices

Sakai VelocitySupport Layer

The

Sak

ai L

egac

y E

nviro

nmen

tSakaiPortal

Sakai Presentation Environments

SakaiFramework APIs

Page 5: Sakai: Localization  & Internationalization

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"])

Page 6: Sakai: Localization  & Internationalization

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')"])

Page 7: Sakai: Localization  & Internationalization

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}" />

Page 8: Sakai: Localization  & Internationalization

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);

Page 9: Sakai: Localization  & Internationalization

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);

Page 10: Sakai: Localization  & Internationalization

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, …

Page 11: Sakai: Localization  & Internationalization

Asian Translations for NEESgrid portal

ChineseJapanese

Korean

Page 12: Sakai: Localization  & Internationalization

How to Translate… in 5 easy steps1) Ingest properties files into MS Excel

Spreadsheet2) Translate English Text in spreadsheet3) Export into Unicode UTF-16 representation4) Convert from UTF-16 into UTF-85) 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)

Page 13: Sakai: Localization  & Internationalization

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

Page 14: Sakai: Localization  & Internationalization

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

Page 15: Sakai: Localization  & Internationalization

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

Page 16: Sakai: Localization  & Internationalization

ResourceLoader Implementation

Page 17: Sakai: Localization  & Internationalization

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

Page 18: Sakai: Localization  & Internationalization

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

Page 19: Sakai: Localization  & Internationalization

Skin Directory Structure

/library/skin/

/default/

/tool.css

/portal.css

/images/

tool_base.css

banner_inst.gif info.gif title.1.gif topleft-tab.gifcheck.gif linkoff.gif title22.gif topleft-tab_hov.gifheadback.gif linkover.gif titleback.gif topright-p-title.gifheadmid.gif linksel.gif titleleft.gif warn.gifheadright.gif logo_inst.gif titleright.gifhelp.gif reload.gif topleft-curtab.gifhelp_h.gif reload_h.gif topleft-p-title.gif

/new-skin/ Define your skin here

Page 20: Sakai: Localization  & Internationalization

Sakai Stylesheet Definitions

Page 21: Sakai: Localization  & Internationalization

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

Page 22: Sakai: Localization  & Internationalization

Page Layout: Space Allocation

Page 23: Sakai: Localization  & Internationalization

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

Page 24: Sakai: Localization  & Internationalization

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

Page 25: Sakai: Localization  & Internationalization

Questions?