C# Class SIL.FieldWorks.FDO.Application.ApplicationServices.XmlTranslatedLists

This class provides the ability to import translations for multi-lingual string fields in one or more lists. See FWR-1739 for motivation.
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
FillInMapForPossibilities void
FindPossibilityAndSetName ICmPossibility
FindQuestionAndSetIt ICmDomainQ
GetItemClassFromAttributes void
GetKeyForPossibility string
GetListFromAttributes ICmPossibilityList
GetMappingForList ICmPossibility>.Dictionary
GetOwnerFromAttribute ICmObject
GetWsFromStr int
GetXmlOfElement string
Import void
ReadDateAttribute System.DateTime
ReadDomainQFromXml void
ReadPossItem void
ReadPossibilitiesFromXml void
ReadQuestionsFromXml void
ReportUnexpectedElement void
SetMultiStringFromXml void
SetMultiUnicodeFromXml void
StoreOrReportUnexpectedElement void
StoreUnanticipatedDataIfPossible bool

Public Methods

Method Description
ImportTranslatedLists ( TextReader reader, FdoCache cache, IProgress progress ) : bool

Import a file (encapsulated by a TextReader) containing translations for one or more lists.

ImportTranslatedLists ( string filename, FdoCache cache, IProgress progress ) : bool

Import a file containing translations for one or more lists.

ImportTranslatedListsForWs ( string ws, FdoCache cache, string templateDir, IProgress progress ) : void

If a localized lists file is available for the specified ws, load the information. Note: call this only when you are sure the WS is new to this project. It takes considerable time to run if it finds a localized list file. Our current strategy for loading localized lists is to have one file per localization. It is always LocalizedLists-XX.zip, where XX is the ICU locale for the writing system. (The zip file contains a single file, LocalizedLists-XX.xml.) So if such a file exists for this WS, we can import lists for that writing system.

TranslatedListsPathForWs ( string ws, string templateDir ) : string

Call before ImportTranslatedListsForWs. Call that only if the file exists.

Private Methods

Method Description
FillInMapForPossibilities ( ICmPossibility>.Dictionary mapNameToItem, IFdoOwningSequence possibilities ) : void

Fills the in map of English name to CmPossibility object.

Allow access to tests.

FindPossibilityAndSetName ( XmlReader xrdr, string ownerPath, ICmPossibility>.Dictionary mapNameToPoss ) : ICmPossibility
FindQuestionAndSetIt ( XmlReader xrdr, ICmDomainQ>.Dictionary mapQuest2Obj ) : ICmDomainQ
GetItemClassFromAttributes ( XmlReader xrdr, string &sItemClass, int &clid ) : void
GetKeyForPossibility ( ICmPossibility item ) : string

Generate a key by appending the name of this CmPossibility to the names of each of its owning CmPossibilities (if the owner is a CmPossibility). The result is a rooted path of English CmPossibility names separated by colons, with a leading colon preceding the CmPossibility at the top level of the list. This allows items at lower levels of the list to have the same name without being confused.

GetListFromAttributes ( XmlReader xrdr ) : ICmPossibilityList
GetMappingForList ( ICmPossibilityList list ) : ICmPossibility>.Dictionary
GetOwnerFromAttribute ( XmlReader xrdr, string &sOwner ) : ICmObject
GetWsFromStr ( string sWs ) : int
GetXmlOfElement ( XmlReader xrdrSub ) : string
Import ( XmlReader xrdr ) : void
ReadDateAttribute ( XmlReader xrdr ) : System.DateTime
ReadDomainQFromXml ( XmlReader xrdrSub, ICmSemanticDomain semdom ) : void
ReadPossItem ( XmlReader xrdrSub, ICmPossibility poss, string sItemClassName, string ownerPath, ICmPossibility>.Dictionary mapNameToPoss ) : void
ReadPossibilitiesFromXml ( XmlReader xrdr, ICmPossibilityList list, string sItemClass, string ownerPath, ICmPossibility>.Dictionary mapNameToPoss = null ) : void
ReadQuestionsFromXml ( XmlReader xrdrSub, ICmSemanticDomain semdom ) : void
ReportUnexpectedElement ( string sItemClass, string sField ) : void
SetMultiStringFromXml ( XmlReader xrdr, IMultiString ms ) : void
SetMultiUnicodeFromXml ( XmlReader xrdr, IMultiUnicode mu ) : void
StoreOrReportUnexpectedElement ( ICmObject obj, XmlReader xrdrSub, string sItemClass ) : void
StoreUnanticipatedDataIfPossible ( ICmObject obj, XmlReader xrdrSub ) : bool

Use the MetaDataCache and reflection to store the XML data if at all possible.

Method Details

ImportTranslatedLists() public method

Import a file (encapsulated by a TextReader) containing translations for one or more lists.
public ImportTranslatedLists ( TextReader reader, FdoCache cache, IProgress progress ) : bool
reader TextReader
cache FdoCache
progress IProgress
return bool

ImportTranslatedLists() public method

Import a file containing translations for one or more lists.
public ImportTranslatedLists ( string filename, FdoCache cache, IProgress progress ) : bool
filename string
cache FdoCache
progress IProgress
return bool

ImportTranslatedListsForWs() public static method

If a localized lists file is available for the specified ws, load the information. Note: call this only when you are sure the WS is new to this project. It takes considerable time to run if it finds a localized list file. Our current strategy for loading localized lists is to have one file per localization. It is always LocalizedLists-XX.zip, where XX is the ICU locale for the writing system. (The zip file contains a single file, LocalizedLists-XX.xml.) So if such a file exists for this WS, we can import lists for that writing system.
public static ImportTranslatedListsForWs ( string ws, FdoCache cache, string templateDir, IProgress progress ) : void
ws string
cache FdoCache
templateDir string
progress IProgress
return void

TranslatedListsPathForWs() public static method

Call before ImportTranslatedListsForWs. Call that only if the file exists.
public static TranslatedListsPathForWs ( string ws, string templateDir ) : string
ws string
templateDir string
return string