コード例 #1
0
        internal static string Gettext(this ILocalizer @this, string msgId, params object[] values)
        {
            if (msgId is null)
            {
                return(null);
            }

            var msgIdWithContext = ConvertToMsgIdWithContext(msgId);

            if (@this is null)
            {
                CompositionRoot.WriteMissingInitializationErrorMessage();
                return(string.Format(msgIdWithContext.MsgId, values));
            }

            if (msgIdWithContext.Context != null)
            {
                return(@this.Catalog.GetParticularString(msgIdWithContext.Context, msgIdWithContext.MsgId, values));
            }
            return(@this.Catalog.GetString(msgIdWithContext.MsgId, values));
        }