public CatalogEntry(Catalog owner, CatalogEntry dt) { this.owner = owner; str = dt.str; plural = dt.plural; hasPlural = dt.hasPlural; translations = new List <string> (dt.translations); references = new List <string> (dt.references); autocomments = new List <string> (dt.autocomments); isFuzzy = dt.isFuzzy; isModified = dt.isModified; isAutomatic = dt.isAutomatic; hasBadTokens = dt.hasBadTokens; moreFlags = dt.moreFlags; comment = dt.comment; validity = dt.validity; errorString = dt.errorString; context = dt.Context; }
public CatalogEntry(Catalog owner, CatalogEntry dt) { this.owner = owner; str = dt.str; plural = dt.plural; hasPlural = dt.hasPlural; translations = new List<string> (dt.translations); references = new List<string> (dt.references); autocomments = new List<string> (dt.autocomments); isFuzzy = dt.isFuzzy; isModified = dt.isModified; isAutomatic = dt.isAutomatic; hasBadTokens = dt.hasBadTokens; moreFlags =dt.moreFlags; comment = dt.comment; validity = dt.validity; errorString = dt.errorString; context = dt.Context; }
protected override bool OnEntry(string msgid, string msgidPlural, bool hasPlural, string[] translations, string flags, string[] references, string comment, string[] autocomments, string msgctxt) { if (String.IsNullOrEmpty(msgid) && !headerParsed) { // gettext header: catalog.ParseHeaderString(translations[0]); catalog.Comment = comment; headerParsed = true; } else { CatalogEntry d = new CatalogEntry(catalog, String.Empty, String.Empty); if (!String.IsNullOrEmpty(flags)) { d.Flags = flags; } d.SetString(msgid); if (hasPlural) { d.SetPluralString(msgidPlural); } d.SetTranslations(translations); d.Comment = comment; for (uint i = 0; i < references.Length; i++) { d.AddReference(references[i]); } for (uint i = 0; i < autocomments.Length; i++) { d.AddAutoComment(autocomments[i]); } d.Context = msgctxt; catalog.AddItem(d); } return(true); }
protected override bool OnEntry(string msgid, string msgidPlural, bool hasPlural, string[] translations, string flags, string[] references, string comment, string[] autocomments, string msgctxt) { if (String.IsNullOrEmpty (msgid) && ! headerParsed) { // gettext header: catalog.ParseHeaderString (translations[0]); catalog.Comment = comment; headerParsed = true; } else { CatalogEntry d = new CatalogEntry (catalog, String.Empty, String.Empty); if (! String.IsNullOrEmpty (flags)) d.Flags = flags; d.SetString (msgid); if (hasPlural) d.SetPluralString (msgidPlural); d.SetTranslations (translations); d.Comment = comment; for (uint i = 0; i < references.Length; i++) { d.AddReference (references[i]); } for (uint i = 0; i < autocomments.Length; i++) { d.AddAutoComment (autocomments[i]); } d.Context = msgctxt; catalog.AddItem (d); } return true; }
static string ToMsgid(CatalogEntry entry) { return ToConstStr( entry.HasContext ? GettextResourceManager.MakeContextMsgid(entry.Context, entry.String) : entry.String); }
/// <summary> /// Write C# code that returns the value for a message. If the message /// has plural forms, it is an expression of type System.String[], otherwise it /// is an expression of type System.String. /// </summary> /// <returns> /// The expression (string or string[]) to initialize hashtable associated object. /// </returns> /// <param name='entry'> /// Catalog entry. /// </param> static string ToMsgstr(CatalogEntry entry) { StringBuilder sb = new StringBuilder(); if (entry.HasPlural) { sb.Append("new System.String[] { "); for(int i = 0; i < entry.TranslationsCount; i++) { if (i > 0) sb.Append(", "); sb.Append(ToConstStr(entry.GetTranslation(i))); } sb.Append(" }"); } else { sb.Append(ToConstStr(entry.GetTranslation(0))); } return sb.ToString(); }