C# Класс i18n.Domain.Concrete.POTranslationRepository

Наследование: ITranslationRepository
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

GetAvailableLanguages() публичный Метод

Checks in first hand settings file, if not found there it checks file structure
public GetAvailableLanguages ( ) : IEnumerable
Результат IEnumerable

GetCacheDependencyForAllLanguages() публичный Метод

public GetCacheDependencyForAllLanguages ( ) : System.Web.Caching.CacheDependency
Результат System.Web.Caching.CacheDependency

GetCacheDependencyForSingleLanguage() публичный Метод

public GetCacheDependencyForSingleLanguage ( string langtag ) : System.Web.Caching.CacheDependency
langtag string
Результат System.Web.Caching.CacheDependency

GetTranslation() публичный Метод

public GetTranslation ( string langtag, List fileNames = null, bool loadingCache = true ) : Translation
langtag string
fileNames List
loadingCache bool
Результат i18n.Domain.Entities.Translation

POTranslationRepository() публичный Метод

public POTranslationRepository ( i18nSettings settings ) : System
settings i18nSettings
Результат System

SaveTemplate() публичный Метод

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.
Результат void

SaveTranslation() публичный Метод

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.
Результат void

TranslationExists() публичный Метод

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"
Результат bool