Académique Documents
Professionnel Documents
Culture Documents
Philippe Dubois
Content of presentation
Page 2
Part 1: Multilingual features in Alfresco Part 2: Presentation of SHARE customization Part 3: Implementation of SHARE customization Part 4: Demo
The SHARE UI
o o o
Governed by governed by intl.accept_languages set in request header. Property files containing the the translations for UI messages. Login page can be customized to propose a drop down for UI language selection.
Page 3
Page 4
o o
Elementary type d:mltext defined in dictionryModel.xml Implemented by org.alfresco.service.cmr.repository.MLT ext MLText is a locale/value map. Uses I18NUtil.
Page 5
Locale Support
o
The locale values are stored as ThreadLocal variable. One for content (threadContentLocale) and for message bundles(threadLocale). If not specified in the thread then defaulted to system locale value or VM parameters -Duser.language=xx -Duser.country=xx
Page 6
Only one lucene field for all languages. Languages can be searched together or independently. In Alfresco model cm:title and cm:description are d:mltext MLText properties are hidden by MLPropertyInterceptor combined to I18NUtil.setLocale(locale), I18NUtil.setContentLocale(locale), I18NUtil.setMLAware(true|false)
Page 7
Multiligualism model
The indexing
o o
All languages can have specific lucene analyzers. Can be configured in WEBINF/classes/alfresco/model/dataTypeAlalysers_l an_variant. Accents, steming,...
Page 8
AnalysisMode
o o o
Governs how d:mltext are indexed. In alfresco/extension you will find languagespecific-index-and-search-context.xml.sample LOCALE_ONLY, LOCALE_AND_ALL, LOCALE_AND_ALL_CONTAINING_LOCALES, LANG_COUNTRY_VARIENT, ...
Page 9
Examples
Locale to expand:fr_FR ExpandingMode:ALL_LANGUAGES *fr_CA* *fr_FR* *fr* *fr_CH* *fr_LU* ****************************************************** Locale to expand:fr_FR ExpandingMode:EXACT_LANGUAGE_AND_ALL ** *fr* ******************************************************
Page 10
Searching
o
Analysis mode only applies to MLText, not to content. If node has aspect cm:mlDocument, can be retrieved using the sys:locale property. Analysis mode can be set using setMlAnalysisMode(MLAnalysisMode mlAnalaysisMode) on SearchParameters. Example locale fr, analysis mode =ALL_LANGUAGES, query= @cm\:mltitle:"pomme" will search for pomme in fr,fr_CA,fr_CH, fr_LU,fr_FR
Page 11
Multilingual features
Multilingual model Multilingual root root
folder
...mlContainer
folder
folder
...mlDocument
...mlDocument
Page 12
Page 13
Interceptors
o
MLPropertyInterceptor follows locale value.Wired on NodeService. MLTranslationInterceptor. An interceptor that replaces files nodes with their equivalent translations according to the locale. It is to be used with the FileFolderService. MLContentInterceptor,returns pivot language content if empty translation.
Page 14
EditionService
o o
Similar to VersioningService but for translations bundles. createEdition(NodeRef translationNodeRef,Map<String, Serializable>versionProperties); VersionHistory getEditions(NodeRef mlContainer);
Page 15
SHARE prototype
Choosing UI language at login or in share
Page 16
SHARE prototype
o o o o o
Share tier only Custom Global Localisation eclipse project Slingshot-login.ftl is modified, drop down containing language choice added to login. Cookie "ALFRESCO_UI_PREFLANG" set with the chosen language Cookie value is recuperated by FakeHeadersFilters and set to be used by GlobalLocalisationFilter. GlobalLocalisationFilter calls the setLocale.
Page 17
SHARE prototype
Allows selection of display and MLText properties edition language
Page 18
SHARE prototype
o o
o o
Uses SHARE module in multi-module.xml Uses LanguageCookieFilter.java, sets cookie MLPREF on the connection between Alfresco and SHARE. At every request the cookie MLPREF is sent and used by LanguageCookieFilter.java to set the current locale for the request. The MLProperty interceptor do the rest... Change-content-language contains the definition of the menu. Menu state is stored in MLLANG cookie on browser.
Page 19
SHARE prototype
Making document multilingual and related indicators
Page 20
SHARE prototype
Making document multilingual and related indicators
Page 21
SHARE prototype
o
2 tiers customization, front and back end. Share multilingual and Custom Global Localisation In share-config-custom.xml, additional action make-multilingual opening a dialog make-multilingual calling the back end action MakeMultilingualAction calling makeMultilingual method.
Page 22
SHARE prototype
Adding translations
Page 23
SHARE prototype
o
o o
In share-config-custom.xml, additional action add-translation opening a dialog addtranslation calling the back end action AddTranslationAction calling addTranslation. The form add-translation contains one custom control translation.ftl. translations.ftl overrides and extend Alfresco.ObjectFinder. Reusing component used for editing associations.
Page 24
SHARE prototype
Documents are tied up together making a multilingual document
Page 25
SHARE prototype
Removing pivot language dissolves the multilingual associations between documents
Page 26
SHARE prototype
o o o
Action remove translation directly calls the backend, because there is no dialog. Calls onRemoveTranslation in removeTranslation.js. removeTranslation.js calls java backed backend webscript matching multilingual/removetranslation.
Page 27
Questions?
Page 28