Multilingual Slides
Transcript of Multilingual Slides
-
7/29/2019 Multilingual Slides
1/28
Multilingualism
in SHARE
Philippe Dubois
-
7/29/2019 Multilingual Slides
2/28
Content of presentation
Part 1: Multilingual features inAlfresco
Part 2: Presentation of SHAREcustomization
Part 3: Implementation of SHAREcustomization
Part 4: Demo
Page 2
-
7/29/2019 Multilingual Slides
3/28
The Multilingual model
The SHARE UIo Governed by governed by
intl.accept_languages set in request header.
o Property files containing the the translationsfor UI messages.
o Login page can be customized to propose adrop down for UI language selection.
Page 3
-
7/29/2019 Multilingual Slides
4/28
The Multilingual model
Page 4
-
7/29/2019 Multilingual Slides
5/28
The Multilingual model
The multilingual properties MLTexto Elementary type d:mltext defined in
dictionryModel.xml
o Implemented byorg.alfresco.service.cmr.repository.MLText
o MLText is a locale/value map.
o Uses I18NUtil.
Page 5
-
7/29/2019 Multilingual Slides
6/28
The Multilingual model
Locale Supporto The locale values are stored as ThreadLocal
variable. One for content
(threadContentLocale) and for messagebundles(threadLocale).
o If not specified in the thread then defaulted tosystem locale value or VM parameters
-Duser.language=xx -Duser.country=xx
Page 6
-
7/29/2019 Multilingual Slides
7/28
The Multilingual model
The MLText indexing.o Only one lucene field for all languages.o Languages can be searched together or
independently.o In Alfresco model cm:title and
cm:description are d:mltexto MLText properties are hidden by
MLPropertyInterceptor combined toI18NUtil.setLocale(locale),I18NUtil.setContentLocale(locale),I18NUtil.setMLAware(true|false)
Page 7
-
7/29/2019 Multilingual Slides
8/28
Multiligualism model
The indexingo All languages can have specific lucene
analyzers.
o Can be configured in WEB-INF/classes/alfresco/model/dataTypeAlalysers_lan_variant.
o Accents, steming,...
Page 8
-
7/29/2019 Multilingual Slides
9/28
The Multilingual model
AnalysisModeo Governs how d:mltext are indexed.o In alfresco/extension you will find language-
specific-index-and-search-context.xml.sampleo LOCALE_ONLY,
LOCALE_AND_ALL,LOCALE_AND_ALL_CONTAINING_LOCALES,
LANG_COUNTRY_VARIENT, ...
Page 9
-
7/29/2019 Multilingual Slides
10/28
The Multilingual model
ExamplesLocale to expand:fr_FRExpandingMode:ALL_LANGUAGES
*fr_CA*
*fr_FR*
*fr*
*fr_CH*
*fr_LU*
******************************************************
Locale to expand:fr_FR
ExpandingMode:EXACT_LANGUAGE_AND_ALL
**
*fr*
******************************************************
Page 10
-
7/29/2019 Multilingual Slides
11/28
The Multilingual model
Searchingo Analysis mode only applies to MLText, not to
content. If node has aspect cm:mlDocument,
can be retrieved using the sys:locale property.o Analysis mode can be set using
setMlAnalysisMode(MLAnalysisModemlAnalaysisMode) on SearchParameters.
o
Example locale fr, analysis mode=ALL_LANGUAGES, query=@cm\:mltitle:"pomme" will search forpomme in fr,fr_CA,fr_CH,fr_LU,fr_FR
Page 11
-
7/29/2019 Multilingual Slides
12/28
Multilingual features
Multilingualmodel
Pivot cm:mlChild
root
Multilingual root
...mlContainer
folder
folderfolder
...mlDocument ...mlDocument
cm:mlChild
Page 12
-
7/29/2019 Multilingual Slides
13/28
The Multilingual model
The translations are handles throughthe MultilingualContentServiceo isTranslation(NodeRef contentNodeRef)o makeTranslation(NodeRef contentNodeRef,
Locale locale)o unmakeTranslation(NodeRef
translationNodeRef)o addTranslation(NodeRef
newTranslationNodeRef, NodeReftranslationOfNodeRef, Locale locale)
Page 13
-
7/29/2019 Multilingual Slides
14/28
The Multilingual model
Interceptorso MLPropertyInterceptorfollows locale
value.Wired on NodeService.
o MLTranslationInterceptor. An interceptorthat replaces files nodes with their equivalenttranslations according to the locale. It is to beused with the FileFolderService.
o MLContentInterceptor,returns pivot languagecontent if empty translation.
Page 14
-
7/29/2019 Multilingual Slides
15/28
The Multilingual model
EditionServiceo Similar to VersioningService but for
translations bundles.
o createEdition(NodeReftranslationNodeRef, Map versionProperties);
o VersionHistory getEditions(NodeRef
mlContainer);
Page 15
-
7/29/2019 Multilingual Slides
16/28
SHARE prototype
Choosing UI language at login or in share
Page 16
-
7/29/2019 Multilingual Slides
17/28
SHARE prototype
o Share tier only
o Custom Global Localisation eclipse project
o Slingshot-login.ftl is modified, drop down
containing language choice added to login.o Cookie "ALFRESCO_UI_PREFLANG" set with the
chosen language
o Cookie value is recuperated by
FakeHeadersFilters and set to be used byGlobalLocalisationFilter.o GlobalLocalisationFilter calls the
setLocale.
Page 17
-
7/29/2019 Multilingual Slides
18/28
SHARE prototype
Allows selection of display and MLText propertiesedition language
Page 18
-
7/29/2019 Multilingual Slides
19/28
SHARE prototype
o Uses SHARE module in multi-module.xml
o Uses LanguageCookieFilter.java, sets cookieMLPREF on the connection betweenAlfresco and SHARE.
o At every request the cookie MLPREF is sent andused by LanguageCookieFilter.java to set thecurrent locale for the request.
o The MLProperty interceptor do the rest...
o Change-content-language contains thedefinition of the menu. Menu state is stored inMLLANG cookie on browser.
Page 19
-
7/29/2019 Multilingual Slides
20/28
SHARE prototype
Making document multilingual and related indicators
Page 20
-
7/29/2019 Multilingual Slides
21/28
SHARE prototype
Making document multilingual and related indicators
Page 21
-
7/29/2019 Multilingual Slides
22/28
SHARE prototype
o 2 tiers customization, front and back end.Share multilingual and Custom GlobalLocalisation
o In share-config-custom.xml,
additional action make-multilingual
opening a dialog make-multilingual
calling the back end action
MakeMultilingualActioncalling makeMultilingual method.
Page 22
-
7/29/2019 Multilingual Slides
23/28
SHARE prototype
Adding translations
Page 23
-
7/29/2019 Multilingual Slides
24/28
SHARE prototype
o In share-config-custom.xml, additional actionadd-translation opening a dialog add-translation calling the back end actionAddTranslationAction calling addTranslation.
o The form add-translation contains onecustom control translation.ftl.
o translations.ftl overrides and extendAlfresco.ObjectFinder. Reusing component
used for editing associations.
Page 24
-
7/29/2019 Multilingual Slides
25/28
SHARE prototype
Documents are tied up together making amultilingual document
Page 25
-
7/29/2019 Multilingual Slides
26/28
SHARE prototype
Removing pivot language dissolves the multilingualassociations between documents
Page 26
-
7/29/2019 Multilingual Slides
27/28
SHARE prototype
o Action remove translation directly callsthe backend, because there is no dialog.
o Calls onRemoveTranslation in
removeTranslation.js.o removeTranslation.js calls java backed
backend webscript matchingmultilingual/removetranslation.
Page 27
-
7/29/2019 Multilingual Slides
28/28
Questions?