Internationalizing Sakai Raúl Mengod Universidad Politécnica de Valencia (Spain)
2 Overview Introduction: Universidad Politécnica de Valencia (UPV) A little bit of History. Internationalizing sakai. Sakai i18n review. Best practices. Localization. I18n organization
3 Valencia, a place to visit
4 CAMPUS DE VERA
5 Introduction Universidad Politécnica Valencia (UPV) –Public academic institution since 1971 –Official and non-official studies –Post – Graduate studies The UPV in numbers –4 Campuses – 15 Colleges –40 Research centers – 40 Official Degrees –20 post graduate studies – Students – Teachers –1.400 Staff
6 Sakai in the UPV Pilot running during 2006 –Full capabilities –Selected group of users Full production System in 2006/2007 –4 servers –Oracle Database –Integrated with SSO –Integrated with enrollment system –4.000 sites – students Based on the version –Customized to university requirements
7 Sakai in the UPV
8 A little bit of History Sakai 2.0 –Universidad de Lleida started the job –Properties files for the strings –Catalan version Sakai 2.1 –Running on mono-lingual platforms –Spanish version not available Sakai –Multi-lingual version by Nagoya University –Resourcebundle.java class –Stored in the Personal Preference Sakai –First version available in Spanish –Multi-lingual capabilities Sakai 2.3 –More languages added –Still with problems
9 Sakai i18n Tasks Allocate all language-dependent strings in the properties files. Translate strings to Spanish Code search for texts not included in the bundles Test multi-lingual platform Find and implement a suitable solution for our requirements to the sakai i18n problems
10 Melete i18n. Foothill College
11 Sakai I18n Standards WG:i18n on the Collab Site lized+Tools+in+Sakai Written by Beth Kirschner Based on the ResourceLoader class –Wrapper for the Loadbundle class –Looks for the sakai user preference Language –Looks for the Browser Language –Gets the server default language –Should we add a session language? Easy change of navigation language Minimize accesses to the database
12 Sakai I18n Standards rnationalized+Tools+in+Sakai JSF based Tools –Create a backing bean for messages in the faces-config file or in the JSP page –Popularize with the properties files –Use it in the same way as LoadBundle based bean Velocity based Tools –Create an instance of the ResourceLoader class –Put it in the context –Reference it as any other variable
13 I18n Best Practices Never forget the standard –All the tools will be implemented in the same way Properties files are our friends –The implementation is language independent –Separate language dependent properties files from files with other resources Separate codified values from displayed names
14 I18n Best Practices None displayed text should be in.java or.jsp files –It is a hard work to develop but it is necessary –The code is more difficult to understand Only user data must be stored in Database. –Avoid storing information needed in the logic of the application –Only the user inserts data in the database, not the application Test programs in more than one language
15 Known Problems on i18n Sakai Confluence Resources Tool needs to respond better to user preference language locale (JIRA SAK-5043) Worksites Tool needs to respond better to user preference language locale (JIRA SAK-5044) Melete needs to be localized and/or use ResourceLoader for language preferences MessageCenter needs to be localized (JIRA SAK-4889) Help text needs to be internationalzed (JIRA SAK-4256) Localize hard-coded strings in SyllabusTool class (JIRA SAK-3853) BasicContentTypeImageService class needs to support language/locales (JIRA SAK-3852) sakai.properties file contains language dependent strings (JIRA SAK-3764) Roster tool does not sort UTF-8 characters correctly (JIRA SAK-3930) Time formats cannot be localized (JIRA SAK-3823, SAK-3824) New internationalized date/time widget is needed (work in progress at UM) (SAK-3825) Tool registration files should support xml:lang attribute (SAK-5296) Our goal: Fix all those problems for 2.4 release
16 Database Stored Strings –Tool names / Site names Use of translated strings in logic decisions –Messagecenter (states) Static pages Date Formats Main Problems on i18n
17 I18n Best Practices Tools / Pages Names –Language at creation time SAKAI_SITE_PAGE.TITLE SAKAI_SITE_TOOL.TITLE
18 I18n Best Practices Our Solution –Every tool/page has a register name (sakai.site.info) –New property file with tool register names as keys –Translate the register key –Store register key in database –Get localized text for the data stored in database –If key is not found in properties files show the text –What should be shown when we edit the site? Key or translated text? –Problems with multiple used tools? (sakai.iframe) Other Solution (SAK-5296) –Tool registration files need to support xml:lang –Tool class would support retrieving the locale-specific text –How to handle tools that may be used one than more time? General Solution –Database based tool for multilingual texts –Applicable to all needed places –Based on Tool/Table/Column/Language/Value
19 I18n Best Practices Labels stored in the database –Gradebook GB_GRADABLE_OBJECT_T.EXTERNAL_APP_NAME
20 I18n Best Practices Samigo: Tool data stored in the database SAM_TYPE_T.KEYWORD
21 I18n Best Practices Use of i18n in logic decisions The topic name for these special folders are created in english and stored in the database
22 I18n Best Practices Use of i18n in logic decisions If the topic title is internationalized the messages dissapear The name of the folder is used to recover the messages
23 I18n Best Practices Solution: Translate only the output org.sakaiproject.tool.messageforums.ui.PrivateForumDecoratedBean; Topic topic = decoTopic.getTopic(); if (topic != null){ if (topic.getTitle().equalsIgnoreCase("Received")) topic.setTitle(rb.getString("state_received")); else if (topic.getTitle().equalsIgnoreCase("Sent")) topic.setTitle(rb.getString("state_sent")); else if (topic.getTitle().equalsIgnoreCase("Deleted")) topic.setTitle(rb.getString("state_deleted")); } new_topics.add(decoTopic); Leave texts on the database in english Translate only the string displayed Compare with the values in english
24 I18n Best Practices Use in duplicate name validation –Control name of special folder org.sakaiproject.tool.messageforums. PrivateMessagesTool /** portlet configuration parameter values**/ public static final String PVTMSG_MODE_RECEIVED = "Received"; public static final String PVTMSG_MODE_SENT = "Sent"; public static final String PVTMSG_MODE_DELETE = "Deleted"; public static final String PVTMSG_MODE_DRAFT = "Drafts"; public static final String PVTMSG_MODE_CASE = "Personal Folders"; //Create a folder within a forum public String processPvtMsgFldCreate() { LOG.debug("processPvtMsgFldCreate()"); String createFolder=getAddFolder() ; if(createFolder == null) { setErrorMessage(getResourceBundleString(ENTER_FOLDER_NAME)); return null ; } else { if(PVTMSG_MODE_RECEIVED.equals(createFolder) || PVTMSG_MODE_SENT.equals(createFolder)|| PVTMSG_MODE_DELETE.equals(createFolder) || PVTMSG_MODE_DRAFT.equals(createFolder)) { setErrorMessage(getResourceBundleString(CREATE_DIFF_FOLDER_NAME)); } else { prtMsgManager.createTopicFolderInForum(forum, createFolder); //create a typeUUID in commons String newTypeUuid= typeManager.getCustomTopicType(createFolder); } return MAIN_PG ; }
25 I18n Best Practices <h:commandButton value="#{msg.button_unique_save_and_publish}" type="submit" rendered="#{not assessmentSettings.hasQuestions}" action="#{assessmentSettings.getOutcomePublish}" disabled="true"> public void processAction(ActionEvent ae) throws AbortProcessingException { synchronized(repeatedPublish) { //FacesContext context = FacesContext.getCurrentInstance(); UIComponent eventSource = (UIComponent) ae.getSource(); ValueBinding vb = eventSource.getValueBinding("value"); String buttonValue = (String) vb.getExpressionString(); if(buttonValue.endsWith("#{msg.button_unique_save_and_publish}")) { repeatedPublish = Boolean.FALSE; return; } Be careful using beans in comparations
26 I18n Best Practices public List getPostingOptions() { List postingOptions = new ArrayList(); postingOptions.add(new SelectItem(PermissionBean.NONE,PermissionBean.NONE)); postingOptions.add(new SelectItem(PermissionBean.OWN,PermissionBean.OWN)); postingOptions.add(new SelectItem(PermissionBean.ALL,PermissionBean.ALL)); return postingOptions; } msgcntr\messageforums-app\src\java\org\sakaiproject\tool\messageforums\DiscussionForumTool.java Separate values and displayed names in Options
27 I18n Best Practices Texts in Bitmap files Solution: Use Anonymous picture
28 Help Tool Special Tool Only in English Not based on property files A different structure
29 Help Tool Include Procedure Guides Available in Different formats (HTML, Flash, VIDEO) Integrated with sakai help Available in Spanish and English Help tool was in plain html files Duplicate the help structure This solution is not good enough for multiple language.
30 Localization Dates –08/05/2006 can be either 8 of May or 5 of August depending on the country you are. –Changes should be done at presentation level. –SAK-3825 (in progress at UM)
31 Localization
32 Localization Order of the Days of Week In Spain Monday is day #1 and Sunday day #7 ¿How are things in other countries?
33 Sakai i18n Coordination Translation Updates We need a more flexible way to update translated strings in newer versions Use some tools or applications –Internationalization Dashboard (Mark Breuker) –Extend this tool to allow on-line translation? It’s a hard work to test if the translations are properly finished
34 Sakai i18n Coordination Official tools List of Languages supported by sakai Should be all translated to the official languages Only translated tools should be moved to official I18n committee?
35 The future Sakai 2.4 i18n Plans –Now it is empty in the confluence site Finish i18n of all tools Database stored strings (Tool Names) Develop a Real multi-lingual help Easy way of changing the language –Flags on the portal page –Duplicate the Gateway Site Multi-lingual contents version –Needs strong changes on some tools
Thank You