Microsoft.Bot.Builder.FormFlow.Advanced.Localizer Class Reference

A resource localizer. More...

Inheritance diagram for Microsoft.Bot.Builder.FormFlow.Advanced.Localizer:

Public Member Functions

void Add (string key, string translation)
 Add a key and its translation. More...
 
void Add (string key, IEnumerable< string > list)
 Add a key and a list of translations separated by semi-colon. More...
 
void Add (string prefix, IReadOnlyDictionary< object, DescribeAttribute > dictionary)
 Adds value from dictionary under object if enumeration and prefix;object otherwise. More...
 
void Add (string prefix, IReadOnlyDictionary< object, TermsAttribute > dictionary)
 Adds values from dictionary separated by semi-colons under object if enumeration and prefix;object otherwise. More...
 
void Add (string prefix, IReadOnlyDictionary< TemplateUsage, TemplateAttribute > templates)
 Adds patterns from template separated by semi-colons under prefix;usage. More...
 
void Add (string prefix, TemplateAttribute template)
 Adds patterns from template separated by semi-colons under prefix;usage. More...
 
ILocalizer Load (IDictionaryEnumerator reader, out IEnumerable< string > missing, out IEnumerable< string > extra)
 Load the localizer from a stream. More...
 
bool Lookup (string key, out string value)
 Translate a key to a translation. More...
 
void LookupDictionary (string prefix, IDictionary< object, DescribeAttribute > dictionary)
 Look up prefix;object from dictionary and replace value from localizer. More...
 
void LookupDictionary (string prefix, IDictionary< object, TermsAttribute > dictionary)
 Look up prefix;object from dictionary and replace values from localizer. More...
 
void LookupTemplates (string prefix, IDictionary< TemplateUsage, TemplateAttribute > templates)
 Looks up prefix;usage and replace patterns in template from localizer. More...
 
bool LookupValues (string key, out string[] values)
 Translate a key to an array of values. More...
 
void Remove (string key)
 Remove a key from the localizer. More...
 
void Save (IResourceWriter writer)
 Save localizer resources to stream. More...
 

Protected Member Functions

IEnumerable< string > AddPrefix (string prefix, IEnumerable< string > suffix)
 

Protected Attributes

Dictionary< string, string[]> _arrayTranslations = new Dictionary<string, string[]>()
 
Dictionary< string, string[]> _templateTranslations = new Dictionary<string, string[]>()
 
Dictionary< string, string > _translations = new Dictionary<string, string>()
 

Properties

CultureInfo Culture [get, set]
 

Detailed Description

A resource localizer.

Definition at line 47 of file Localizer.cs.

Member Function Documentation

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Add ( string  key,
string  translation 
)
inline

Add a key and its translation.

Parameters
keyKey for indexing translation.
translationTranslation for key.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 51 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Add ( string  key,
IEnumerable< string >  list 
)
inline

Add a key and a list of translations separated by semi-colon.

Parameters
keyKey for indexing translation list.
listList of translated terms.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 59 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Add ( string  prefix,
IReadOnlyDictionary< object, DescribeAttribute dictionary 
)
inline

Adds value from dictionary under object if enumeration and prefix;object otherwise.

Parameters
prefixThe resource prefix.
dictionaryThe dictionary to add.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 67 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Add ( string  prefix,
IReadOnlyDictionary< object, TermsAttribute dictionary 
)
inline

Adds values from dictionary separated by semi-colons under object if enumeration and prefix;object otherwise.

Parameters
prefixThe resource prefix.
dictionaryThe dictionary to add.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 93 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Add ( string  prefix,
IReadOnlyDictionary< TemplateUsage, TemplateAttribute templates 
)
inline

Adds patterns from template separated by semi-colons under prefix;usage.

Parameters
prefixThe resource prefix.
templatesThe template dictionary to add.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 115 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Add ( string  prefix,
TemplateAttribute  template 
)
inline

Adds patterns from template separated by semi-colons under prefix;usage.

Parameters
prefixThe resource prefix.
templateThe template to add.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 123 of file Localizer.cs.

IEnumerable<string> Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.AddPrefix ( string  prefix,
IEnumerable< string >  suffix 
)
inlineprotected

Definition at line 310 of file Localizer.cs.

ILocalizer Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Load ( IDictionaryEnumerator  reader,
out IEnumerable< string >  missing,
out IEnumerable< string >  extra 
)
inline

Load the localizer from a stream.

Parameters
readerDictionary with resources.
missingKeys found in current localizer that are not in loaded localizer.
extraKeys found in loaded localizer that were not in current localizer.
Returns
New localizer from reader.

Save(IResourceWriter) to see resource format.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 220 of file Localizer.cs.

bool Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Lookup ( string  key,
out string  value 
)
inline

Translate a key to a translation.

Parameters
keyKey to lookup.
valueValue to set if present.
Returns
True if value is found.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 131 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.LookupDictionary ( string  prefix,
IDictionary< object, DescribeAttribute dictionary 
)
inline

Look up prefix;object from dictionary and replace value from localizer.

Parameters
prefixThe prefix.
dictionaryDictionary with existing values.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 141 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.LookupDictionary ( string  prefix,
IDictionary< object, TermsAttribute dictionary 
)
inline

Look up prefix;object from dictionary and replace values from localizer.

Parameters
prefixThe prefix.
dictionaryDictionary with existing values.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 180 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.LookupTemplates ( string  prefix,
IDictionary< TemplateUsage, TemplateAttribute templates 
)
inline

Looks up prefix;usage and replace patterns in template from localizer.

Parameters
prefixThe prefix.
templatesTemplate dictionary with existing values.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 201 of file Localizer.cs.

bool Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.LookupValues ( string  key,
out string[]  values 
)
inline

Translate a key to an array of values.

Parameters
keyKey to lookup.
valuesArray value to set if present.
Returns
True if value is found.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 136 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Remove ( string  key)
inline

Remove a key from the localizer.

Parameters
keyKey to remove.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 213 of file Localizer.cs.

void Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Save ( IResourceWriter  writer)
inline

Save localizer resources to stream.

Parameters
writerWhere to write resources.

Resource values are all strings. The key and value can have different parts separated by semi-colons.

Key Value Description
key;VALUE string Simple value.
key;LIST string[;string]* List of values.
usage;field[;field]*;TEMPLATE pattern[;pattern]* List of template patterns. Key includes fields that use template.

Implements Microsoft.Bot.Builder.FormFlow.Advanced.ILocalizer.

Definition at line 267 of file Localizer.cs.

Member Data Documentation

Dictionary<string, string[]> Microsoft.Bot.Builder.FormFlow.Advanced.Localizer._arrayTranslations = new Dictionary<string, string[]>()
protected

Definition at line 316 of file Localizer.cs.

Dictionary<string, string[]> Microsoft.Bot.Builder.FormFlow.Advanced.Localizer._templateTranslations = new Dictionary<string, string[]>()
protected

Definition at line 317 of file Localizer.cs.

Dictionary<string, string> Microsoft.Bot.Builder.FormFlow.Advanced.Localizer._translations = new Dictionary<string, string>()
protected

Definition at line 315 of file Localizer.cs.

Property Documentation

CultureInfo Microsoft.Bot.Builder.FormFlow.Advanced.Localizer.Culture
getset

Definition at line 49 of file Localizer.cs.


The documentation for this class was generated from the following file: