本文整理汇总了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);
}
示例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;
}