当前位置: 首页>>代码示例>>C#>>正文


C# Translation.Post方法代码示例

本文整理汇总了C#中Translation.Post方法的典型用法代码示例。如果您正苦于以下问题:C# Translation.Post方法的具体用法?C# Translation.Post怎么用?C# Translation.Post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Translation的用法示例。


在下文中一共展示了Translation.Post方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

    public static string Get(string screen, string key, Bm2s.Poco.Common.Parameter.Language language, string defaultValue, params string[] parameters)
    {
      string result = (string)HttpContext.Current.Session[TranslationUtils.TranslationSessionKey + "_" + screen + "_" + key + "_" + language.Id];

      if (string.IsNullOrWhiteSpace(result))
      {
        Translation translation = new Translation();
        translation.Request.Application = TranslationUtils.ApplicationName;
        translation.Request.LanguageId = language.Id;
        translation.Request.Screen = screen;
        translation.Request.Key = key;
        translation.Get();

        if (!translation.Response.Translations.Any())
        {
          translation.Request.Translation = new Bm2s.Poco.Common.Parameter.Translation()
          {
            Application = TranslationUtils.ApplicationName,
            Key = key,
            Language = language,
            Screen = screen,
            Value = defaultValue
          };
          translation.Post();
        }

        result = translation.Response.Translations.FirstOrDefault().Value;
        HttpContext.Current.Session[TranslationUtils.TranslationSessionKey + "_" + screen + "_" + key + "_" + language.Id] = result;
      }

      return string.Format(result, parameters);
    }
开发者ID:Csluikidikilest,项目名称:Bm2sBO,代码行数:32,代码来源:TranslationUtils.cs

示例2: Set

    public static int Set(string screen, string key, Bm2s.Poco.Common.Parameter.Language language, string value)
    {
      Translation translation = new Translation();
      translation.Request.Application = TranslationUtils.ApplicationName;
      translation.Request.Screen = screen;
      translation.Request.Key = key;
      translation.Request.LanguageId = language.Id;
      translation.Get();
      Bm2s.Poco.Common.Parameter.Translation tran = translation.Response.Translations.FirstOrDefault();

      translation.Request.Translation = new Bm2s.Poco.Common.Parameter.Translation();
      translation.Request.Translation.Application = TranslationUtils.ApplicationName;
      translation.Request.Translation.Screen = screen;
      translation.Request.Translation.Key = key;
      translation.Request.Translation.Language = language;
      translation.Request.Translation.Value = value;
      if (tran != null)
      {
        translation.Request.Translation.Id = tran.Id;
      }
      translation.Post();

      HttpContext.Current.Session[TranslationUtils.TranslationSessionKey + "_" + screen + "_" + key + "_" + translation.Request.LanguageId] = value;

      return translation.Response.Translations.FirstOrDefault().Id;
    }
开发者ID:Csluikidikilest,项目名称:Bm2sBO,代码行数:26,代码来源:TranslationUtils.cs


注:本文中的Translation.Post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。