Skip to content
Damien Daspit edited this page Dec 9, 2015 · 3 revisions

SIL.Lexicon contains various lexicon utility classes that can be used across applications. Currently, this assembly contains classes for persisting lexicon settings that can be shared by different lexicon applications. Any new shared lexicon functionality should be added to this assembly.

Shared Lexicon Settings

SIL currently has a number of lexicon applications, including FieldWorks Language Explorer, WeSay, and LanguageForge. In an effort to increase interoperability between these lexicon applications, SIL.Lexicon has defined a set of classes for persisting common lexicon settings in a standard XML format. This common settings format will be useful when sending/receiving between lexicon applications or when importing a lexicon project from one application to another. Some of these settings are writing system definition properties. To facilitate the persisting of these settings in the common lexicon settings format, SIL.Lexicon provides implementations of the SIL.WritingSystems.ICustomDataMapper interface that can be used in applications. SIL.Lexicon also seeks to standardize the file names that are used when saving the lexicon settings. This information is encapsulated in the LexiconSettingsFileHelper class. The lexicon settings are split into two different formats: project settings and user settings.

Settings Store

SIL.Lexicon decouples the actual persistence mechanism from the XML format through the use of the ISettingsStore interface. This interface is implemented by classes that define how the XML data is actually persisted, i.e. separate configuration file, embedded in another configuration file, etc. The primary implementation of this interface is the FileSettingsStore class. This implementation saves the XML data to its own file. The file path is specified in the constructor. The ApplicationSettingsStore class saves the XML data to a .NET application settings file using the System.Configuration API. The MemorySettingsStore is provided for testing purposes.

Project Settings

Project settings are settings that are shared by all users of a project. The ProjectLexiconSettingsDataMapper class is used to read and write settings that are not related to writing system definitions. An instance of the ProjectLexiconSettings class is loaded with the settings on read and saved on write. The ProjectLexiconSettingsWritingSystemDataMapper class implements the SIL.WritingSystems.ICustomDataMapper and can be passed to a writing system repository to save writing system definition properties to the lexicon settings XML. The following is an example of a project settings file:

<ProjectLexiconSettings>
	<WritingSystems addToSldr="true">
		<WritingSystem id="en">
			<Abbreviation>Eng</Abbreviation>
			<SpellCheckingId>en_US</SpellCheckingId>
			<SystemCollation>en-US</SystemCollation>
		</WritingSystem>
	</WritingSystems>
</ProjectLexiconSettings>

User Settings

User settings are settings that only apply to a single user. UserLexiconSettingsWritingSystemDataMapper class implements the SIL.WritingSystems.ICustomDataMapper and can be passed to a writing system repository to save writing system definition properties to the lexicon settings XML. The following is an example of a user settings file:

<UserLexiconSettings>
	<WritingSystems>
		<WritingSystem id="en">
			<LocalKeyboard>en-US_English</LocalKeyboard>
			<KnownKeyboards>
				<KnownKeyboard>en-US_English</KnownKeyboard>
			</KnownKeyboards>
			<DefaultFontName>Arial</DefaultFontName>
			<DefaultFontSize>12</DefaultFontSize>
		</WritingSystem>
	</WritingSystems>
</UserLexiconSettings>