Example #1
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());
        }