예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 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);
 }
예제 #4
0
        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;
        }
예제 #5
0
 static string ToMsgid(CatalogEntry entry)
 {
     return ToConstStr(
         entry.HasContext ?
         GettextResourceManager.MakeContextMsgid(entry.Context, entry.String) : entry.String);
 }
예제 #6
0
 /// <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();
 }