• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Translation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Translation类属于命名空间,在下文中一共展示了Translation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
		}
开发者ID:pierceboggan,项目名称:Verses,代码行数:7,代码来源:BiblesDotOrg.cs


示例2: ctor_T

        public void ctor_T()
        {
            const int expected = 123;
            var actual = new Translation<int>(expected).Value;

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Translation`1.Facts.cs


示例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);
		}
开发者ID:pierceboggan,项目名称:Verses,代码行数:7,代码来源:BiblesDotOrg.cs


示例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);
		}
开发者ID:pierceboggan,项目名称:Verses,代码行数:7,代码来源:BiblesDotOrg.cs


示例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);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Translation`1.Facts.cs


示例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);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Translation`1.Facts.cs


示例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);
        }
开发者ID:ZiberSoftware,项目名称:ziber-translate,代码行数:30,代码来源:ImportController.cs


示例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);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Translation`1.Facts.cs


示例9: DeleteTranslation

 public bool DeleteTranslation(Translation entity)
 {
     if (entity == null) return false;
     _unitOfWork.TranslationRepository.Delete(entity);
     _unitOfWork.Save();
     return true;
 }
开发者ID:edgecomputing,项目名称:cats-hub-module,代码行数:7,代码来源:TranslationService.cs


示例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);
        }
开发者ID:edgecomputing,项目名称:mvc-language,代码行数:7,代码来源:TranslationService.cs


示例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();
 }
开发者ID:ZiberSoftware,项目名称:ziber-translate,代码行数:7,代码来源:TranslationVoteService.cs


示例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;
    }
开发者ID:Csluikidikilest,项目名称:Bm2sBO,代码行数:26,代码来源:TranslationUtils.cs


示例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);
    }
开发者ID:Csluikidikilest,项目名称:Bm2sBO,代码行数:32,代码来源:TranslationUtils.cs


示例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;
        }
开发者ID:vtcharlie,项目名称:esl.sdk.net,代码行数:13,代码来源:TranslationBuilder.cs


示例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;
        }
开发者ID:pierceboggan,项目名称:Verses,代码行数:9,代码来源:BiblesDotOrgRequest.cs


示例16: Build

        /**
         * Builds the list of translation
         *
         * @return the list of translation
         */
        public Translation Build() {
			Support.LogMethodEntry();
            Translation result = new Translation();
            result.Name = name;
            result.Description = description;
            result.Language = language;
			Support.LogMethodExit(result);
            return result;
        }
开发者ID:janstadt,项目名称:esl.sdk.net,代码行数:14,代码来源:TranslationBuilder.cs


示例17: Create

 public static TranslationDto Create(Translation translation)
 {
     return new TranslationDto()
     {
         Id = translation.Id,
         Label = translation.Label,
         HelpText = translation.HelpText,
         TranslationId = translation.TranslationId
     };
 }
开发者ID:altschuler,项目名称:stikprove-api,代码行数:10,代码来源:TranslationDto.cs


示例18: op_Contains_Translation

        public void op_Contains_Translation()
        {
            var item = new Translation<int>(123, "en");
            var obj = new TranslationDictionary<int>
                          {
                              item
                          };

            Assert.True(obj.Contains(item));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:10,代码来源:TranslationDictionary`1.Facts.cs


示例19: RemoveVote

        public static void RemoveVote(Translation translation)
        {
            var voter = TranslatorService.FindByEmail(HttpContext.Current.User.Identity.Name);
            var vote = FindVote(translation, voter);

            if (vote != null)
            {
                if(vote.IsPublished == false)
                    Global.CurrentSession.Delete(vote);
            }
        }
开发者ID:ZiberSoftware,项目名称:ziber-translate,代码行数:11,代码来源:TranslationVoteService.cs


示例20: DisplayTime

        /// <summary>
        /// Convert a number of seconds into a human readable form. Rounds up.
        /// To be consistent with zxcvbn, it returns the unit + 1 (i.e. 60 * 10 seconds = 10 minutes would come out as "11 minutes"
        /// this is probably to avoid ever needing to deal with plurals
        /// </summary>
        /// <param name="seconds">The time in seconds</param>
        /// <param name="translation">The language in which the string is returned</param>
        /// <returns>A human-friendly time string</returns>
        public static string DisplayTime(double seconds, Translation translation = Translation.English)
        {
            long minute = 60, hour = minute * 60, day = hour * 24, month = day * 31, year = month * 12, century = year * 100;

            if (seconds < minute) return GetTranslation("instant", translation);
            else if (seconds < hour) return string.Format("{0} " + GetTranslation("minutes", translation), (1 + Math.Ceiling(seconds / minute)));
            else if (seconds < day) return string.Format("{0} " + GetTranslation("hours", translation), (1 + Math.Ceiling(seconds / hour)));
            else if (seconds < month) return string.Format("{0} " + GetTranslation("days", translation), (1 + Math.Ceiling(seconds / day)));
            else if (seconds < year) return string.Format("{0} " + GetTranslation("months", translation), (1 + Math.Ceiling(seconds / month)));
            else if (seconds < century) return string.Format("{0} " + GetTranslation("years", translation), (1 + Math.Ceiling(seconds / year)));
            else return GetTranslation("centuries", translation);
        }
开发者ID:bitbeans,项目名称:zxcvbn-cs,代码行数:20,代码来源:Utility.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TranslationUnit类代码示例发布时间:2022-05-24
下一篇:
C# TransitionType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap