C# Class Griffin.MvcContrib.SqlServer.Localization.SqlLocalizedTypesRepository

Used to localize types
Inheritance: ILocalizedTypesRepository, ITypePromptImporter
Datei anzeigen Open project: jgauffin/griffin.mvccontrib Class Usage Examples

Protected Properties

Property Type Description
_db ILocalizationDbContext

Public Methods

Method Description
CreateLanguage ( CultureInfo culture, CultureInfo templateCulture ) : void

Create translation for a new language

Delete ( CultureInfo culture, TypePromptKey key ) : void

Delete a prompt.

GetAvailableLanguages ( ) : IEnumerable

Get all languages that got partial or full translations.

GetPrompt ( CultureInfo culture, TypePromptKey key ) : TypePrompt

Get a specific prompt

GetPrompts ( CultureInfo cultureInfo, CultureInfo defaultCulture, Griffin.MvcContrib.Localization.SearchFilter filter ) : IEnumerable

Get all prompts

Import ( IEnumerable prompts ) : void

Import prompts into the repository.

Batch for inserting/updating several rows.

This method is not database engine independent (it uses SqlServers MERGE INTO). You must override it to add support for other databases than SqlServer (for instance using REPLACE INTO in MySQL)

Save ( CultureInfo culture, string fullTypeName, string name, string translatedText ) : void

Create or update a prompt

SqlLocalizedTypesRepository ( ILocalizationDbContext db ) : System

Initializes a new instance of the SqlLocalizedTypesRepository class.

Update ( CultureInfo culture, TypePromptKey key, string translatedText ) : void

Update translation

Private Methods

Method Description
Create ( CultureInfo culture, string fullTypeName, string name, string translatedText ) : void
Exists ( CultureInfo culture, TypePromptKey key ) : bool
MapEntity ( IDataRecord record ) : TypePrompt
Save ( CultureInfo culture, Type type, string name, string translatedText ) : void

Method Details

CreateLanguage() public method

Create translation for a new language
public CreateLanguage ( CultureInfo culture, CultureInfo templateCulture ) : void
culture System.Globalization.CultureInfo Language to create
templateCulture System.Globalization.CultureInfo Language to use as a template
return void

Delete() public method

Delete a prompt.
public Delete ( CultureInfo culture, TypePromptKey key ) : void
culture System.Globalization.CultureInfo Culture to delete prompt in
key TypePromptKey Prompt key
return void

GetAvailableLanguages() public method

Get all languages that got partial or full translations.
public GetAvailableLanguages ( ) : IEnumerable
return IEnumerable

GetPrompt() public method

Get a specific prompt
public GetPrompt ( CultureInfo culture, TypePromptKey key ) : TypePrompt
culture System.Globalization.CultureInfo Culture to get prompt for
key TypePromptKey Key which is unique in the current language
return TypePrompt

GetPrompts() public method

Get all prompts
public GetPrompts ( CultureInfo cultureInfo, CultureInfo defaultCulture, Griffin.MvcContrib.Localization.SearchFilter filter ) : IEnumerable
cultureInfo System.Globalization.CultureInfo Culture to get prompts for
defaultCulture System.Globalization.CultureInfo Culture used as template to be able to include all non-translated prompts
filter Griffin.MvcContrib.Localization.SearchFilter The filter.
return IEnumerable

Import() public method

Import prompts into the repository.

Batch for inserting/updating several rows.

This method is not database engine independent (it uses SqlServers MERGE INTO). You must override it to add support for other databases than SqlServer (for instance using REPLACE INTO in MySQL)

public Import ( IEnumerable prompts ) : void
prompts IEnumerable Prompts to import
return void

Save() public method

Create or update a prompt
public Save ( CultureInfo culture, string fullTypeName, string name, string translatedText ) : void
culture System.Globalization.CultureInfo Culture that the prompt is for
fullTypeName string Type.FullName for the type being localized
name string Property name and any additonal names (such as metadata name, use underscore as delimiter)
translatedText string Translated text string
return void

SqlLocalizedTypesRepository() public method

Initializes a new instance of the SqlLocalizedTypesRepository class.
public SqlLocalizedTypesRepository ( ILocalizationDbContext db ) : System
db ILocalizationDbContext Database connection.
return System

Update() public method

Update translation
public Update ( CultureInfo culture, TypePromptKey key, string translatedText ) : void
culture System.Globalization.CultureInfo Culture that the prompt is for
key TypePromptKey Unique key, in the specified language only, for the prompt to get)
translatedText string Translated text string
return void

Property Details

_db protected_oe property

database context
protected ILocalizationDbContext _db
return ILocalizationDbContext