本文整理汇总了C#中Translation类的典型用法代码示例。如果您正苦于以下问题:C# Translation类的具体用法?C# Translation怎么用?C# Translation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Translation类属于命名空间,在下文中一共展示了Translation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCopyrightForTranslationAsync
public static async Task<string> GetCopyrightForTranslationAsync (Translation translation)
{
var request = BiblesDotOrgRequest.FormatVerseRequest ("Genesis 1:1", translation);
var response = await BiblesDotOrgResponse.RequestVerseAsync (request);
return Convert.ToCopyrightText (response);
}
示例2: ctor_T
public void ctor_T()
{
const int expected = 123;
var actual = new Translation<int>(expected).Value;
Assert.Equal(expected, actual);
}
示例3: GetVerseAsync
public static async Task<VerseResponse> GetVerseAsync (string verse, Translation translation)
{
var request = BiblesDotOrgRequest.FormatVerseRequest (verse, translation);
var response = await BiblesDotOrgResponse.RequestVerseAsync (request);
return Convert.ToVerse (verse, response);
}
示例4: GetVerseTextWithoutHtmlOrDigitsAsync
public static async Task<string> GetVerseTextWithoutHtmlOrDigitsAsync (string verse, Translation translation)
{
var request = BiblesDotOrgRequest.FormatVerseRequest (verse, translation);
var response = await BiblesDotOrgResponse.RequestVerseAsync (request);
return Convert.ToVerseTextWithoutHtmlOrDigits (response);
}
示例5: opEquality_Language_Language
public void opEquality_Language_Language()
{
var obj = new Translation<int>(123, "en");
var comparand = new Translation<int>(123, "en");
Assert.True(obj == comparand);
}
示例6: ctor_T_Language
public void ctor_T_Language()
{
var obj = new Translation<int>(123, "en");
Assert.Equal(new Language("en"), obj.Language);
Assert.Equal(123, obj.Value);
}
示例7: Import
private void Import(string file, TranslateSet set, TranslateCategory category, Language language)
{
var xmlText = System.IO.File.ReadAllText(file);
var xml = XElement.Parse(xmlText);
foreach (var data in xml.Descendants("data"))
{
string key = data.Attribute("name").Value;
string value = data.Descendants("value").Single().Value;
var translateKey = set.TranslateKeys.Where(x => x.Label == key && x.Set == set).SingleOrDefault();
if (translateKey == null)
{
translateKey = new TranslateKey
{
Label = key,
Set = set,
Category = category
};
set.TranslateKeys.Add(translateKey);
}
var translation = new Translation() { Key = translateKey, Language = language, Translator = null, Value = value };
DbSession.Save(translateKey);
DbSession.Save(translation);
}
Global.CurrentSession.Update(set);
}
示例8: opInequality_Language_Language
public void opInequality_Language_Language()
{
var obj = new Translation<int>(123, "en");
var comparand = new Translation<int>(123, "en");
Assert.False(obj != comparand);
}
示例9: DeleteTranslation
public bool DeleteTranslation(Translation entity)
{
if (entity == null) return false;
_unitOfWork.TranslationRepository.Delete(entity);
_unitOfWork.Save();
return true;
}
示例10: InsertNewTerm
public static void InsertNewTerm(string term)
{
// I'm missing something here but could not figure it out right now!
var item = new Translation { Phrase = term, TranslatedText = "", LanguageID = DEFAULT_LANGUAGE_ID };
db.Insert(TRANSLATION_TABLE, TRANSLATION_ID, true, item);
}
示例11: FindVote
public static TranslationVote FindVote(Translation translation, Translator translator)
{
return Global.CurrentSession.QueryOver<TranslationVote>()
.Where(x => x.Translation == translation)
.And(x => x.Translator == translator)
.SingleOrDefault();
}
示例12: 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;
}
示例13: 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);
}
示例14: Build
/**
* Builds the list of translation
*
* @return the list of translation
*/
public Translation Build() {
Translation result = new Translation();
result.Name = name;
result.Description = description;
result.Language = language;
return result;
}
示例15: FormatVerseRequest
public static HttpWebRequest FormatVerseRequest(string verse, Translation translation)
{
var request = "https://www.bibles.org/v2/search.js?query=" + verse + "&version="
+ GetVersionText (translation);
var webRequest = WebRequest.Create (request) as HttpWebRequest;
webRequest.Credentials = new NetworkCredential (APIKey.BiblesDotOrg, "X");
return webRequest;
}