C# Class i18n.Domain.Concrete.POTranslationRepository

Inheritance: ITranslationRepository
Afficher le fichier Open project: turquoiseowl/i18n Class Usage Examples

Méthodes publiques

Méthode Description
GetAvailableLanguages ( ) : IEnumerable

Checks in first hand settings file, if not found there it checks file structure

GetCacheDependencyForAllLanguages ( ) : System.Web.Caching.CacheDependency
GetCacheDependencyForSingleLanguage ( string langtag ) : System.Web.Caching.CacheDependency
GetTranslation ( string langtag, List fileNames = null, bool loadingCache = true ) : Translation
POTranslationRepository ( i18nSettings settings ) : System
SaveTemplate ( TemplateItem>.IDictionary items ) : void

Saves a template file which is a all strings (needing translation) used in the entire project. Not language dependent

SaveTranslation ( Translation translation ) : void

Saves a translation into file with standard pattern locale/langtag/message.po Also saves a backup of previous version

TranslationExists ( string langtag ) : bool

Checks if the language is set as supported in config file If not it checks if the PO file is available

Private Methods

Méthode Description
GetAbsoluteLocaleDir ( ) : string

Gets the locale directory from settings and makes sure it is translated into absolut path

GetPathForLanguage ( string langtag, string filename = null ) : string
ParseBody ( TextReader fs, string line, IEnumerable extractedComments ) : TranslationItem

Parses the body of a PO file item. That is to say the message id and the message itself. Reason for why it must be on second line (textreader) is so that you can read until you have read to far without peek previously for meta data.

ParseTranslationFile ( string langtag, List fileNames, bool loadingCache ) : Translation

Parses a PO file into a Language object

RemoveCommentIfHistorical ( string line ) : string

Removes the preceding characters in a file showing that an item is historical/log. That is to say it has been removed from the project. We don't need care about the character as the fact that it lacks references is what tells us it's a log item

SaveTemplate ( TemplateItem>.IDictionary items, string fileName ) : void
Unescape ( string s ) : string

Looks up in the subject string standard C escape sequences and converts them to their actual character counterparts.

Unquote ( string lhs, string quotechar = "\"" ) : string
WriteString ( StreamWriter stream, bool hasReferences, string type, string value ) : void

Helper for writing either a msgid or msgstr to the po file.

escape ( string s ) : string

Method Details

GetAvailableLanguages() public méthode

Checks in first hand settings file, if not found there it checks file structure
public GetAvailableLanguages ( ) : IEnumerable
Résultat IEnumerable

GetCacheDependencyForAllLanguages() public méthode

public GetCacheDependencyForAllLanguages ( ) : System.Web.Caching.CacheDependency
Résultat System.Web.Caching.CacheDependency

GetCacheDependencyForSingleLanguage() public méthode

public GetCacheDependencyForSingleLanguage ( string langtag ) : System.Web.Caching.CacheDependency
langtag string
Résultat System.Web.Caching.CacheDependency

GetTranslation() public méthode

public GetTranslation ( string langtag, List fileNames = null, bool loadingCache = true ) : Translation
langtag string
fileNames List
loadingCache bool
Résultat i18n.Domain.Entities.Translation

POTranslationRepository() public méthode

public POTranslationRepository ( i18nSettings settings ) : System
settings i18nSettings
Résultat System

SaveTemplate() public méthode

Saves a template file which is a all strings (needing translation) used in the entire project. Not language dependent
public SaveTemplate ( TemplateItem>.IDictionary items ) : void
items TemplateItem>.IDictionary A list of template items to save. The list should be all template items for the entire project.
Résultat void

SaveTranslation() public méthode

Saves a translation into file with standard pattern locale/langtag/message.po Also saves a backup of previous version
public SaveTranslation ( Translation translation ) : void
translation i18n.Domain.Entities.Translation The translation you wish to save. Must have Language shortag filled out.
Résultat void

TranslationExists() public méthode

Checks if the language is set as supported in config file If not it checks if the PO file is available
public TranslationExists ( string langtag ) : bool
langtag string The tag for which you want to check if support exists. For instance "sv-SE"
Résultat bool