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

C# ITranslation类代码示例

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

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



ITranslation类属于命名空间,在下文中一共展示了ITranslation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WebSocketInterface

        public WebSocketInterface(int port, ITranslation translations)
        {
            _server = new WebSocketServer();
            var setupComplete = _server.Setup(new ServerConfig
            {
                Name = "NecroWebSocket",
                Ip = "Any",
                Port = port,
                Mode = SocketMode.Tcp,
                Security = "tls",
                Certificate = new CertificateConfig
                {
                    FilePath = @"cert.pfx",
                    Password = "necro"
                }
            });

            if (setupComplete == false)
            {
                Logger.Write(translations.GetTranslation(TranslationString.WebSocketFailStart, port), LogLevel.Error);
                return;
            }

            _server.NewMessageReceived += HandleMessage;
            _server.NewSessionConnected += HandleSession;

            _server.Start();
        }
开发者ID:Rozzla,项目名称:NecroBot,代码行数:28,代码来源:WebSocketInterface.cs


示例2: HomeController

 public HomeController(IHomeZoneService homeZoneService, IMenuService menuService, ITranslation translation)
 {
     //_userManager = userManager;
     _homeZoneService = homeZoneService;
     _menuService = menuService;
     _translation = translation;
 }
开发者ID:ChuHaiQuan,项目名称:SSO_SITE,代码行数:7,代码来源:HomeController.cs


示例3: ArticleDetailPage

		public ArticleDetailPage(ITranslation translation, IArticleDetailPageViewModel viewModel)
		{
			_translation = translation;
			_viewModel = viewModel;
			BindingContext = _viewModel;
			CreateUI();
		}
开发者ID:ChristianWeyer,项目名称:myProducts-End-to-End,代码行数:7,代码来源:ArticleDetailPage.cs


示例4: MenuService

 public MenuService(IMenuHolder holder,
     IAccountPermissionsManager userPermissionsManager, ITranslation translation)
 {
     _holder = holder;
     _userPermissionsManager = userPermissionsManager;
     _translation = translation;
 }
开发者ID:ChuHaiQuan,项目名称:SSO_SITE,代码行数:7,代码来源:MenuService.cs


示例5: AddTranslationItemsFromFields

        public static void AddTranslationItemsFromFields(string category, object obj, ITranslation translation)
        {
            if (obj == null)
                return;

            AddTranslationItemsFromList(category, translation, GetObjProperties(obj, "$this"));
        }
开发者ID:NoUsername,项目名称:gitextensions,代码行数:7,代码来源:TranslationUtl.cs


示例6: EnsureTranslationIsNotADuplicate

		private void EnsureTranslationIsNotADuplicate(ITranslation translationToAdd)
		{
			if (_translations.ContainsKey(translationToAdd.IsoCode))
			{
				throw new Exception(String.Format("{0} has already been added as a translation", translationToAdd.IsoCode));
			}
		}
开发者ID:ChristianWeyer,项目名称:myProducts-End-to-End,代码行数:7,代码来源:LanguageManager.cs


示例7: AddTranslation

		public void AddTranslation(ITranslation translation)
		{
			EnsureOnlyOneDefaultLanguage(translation);
			EnsureTranslationIsNotADuplicate(translation);

			_translations.Add(translation.IsoCode, translation);
		}
开发者ID:ChristianWeyer,项目名称:myProducts-End-to-End,代码行数:7,代码来源:LanguageManager.cs


示例8: TEditor

 public TEditor(ListBox lb, ISong song, GUI owner, ITranslation trans)
 {
     //
     // Erforderlich für die Windows Form-Designerunterstützung
     //
     InitializeComponent();
     this.AcceptButton = this.button1;
     this.song = song;
     this.trans = trans;
     this.lb = lb;
     this.owner = owner;
     this.textBox2.Text = this.song.Number.ToString();
     this.textBox2.Enabled = false;
     tEditor = this;
     TEditorOpen = true;
     if (this.trans != null)
     {
         this.textBox1.Text = this.trans.Title;
         this.richTextBox1.Text = this.trans.Text;
         this.checkBox1.Checked = this.trans.Unformatted;
         this.panel1.Enabled = !this.trans.Unformatted;
     }
     else
     {
         this.textBox1.Text = "";
         this.richTextBox1.Text = "";
     }
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:28,代码来源:TEditor.cs


示例9: EnsureOnlyOneDefaultLanguage

		private void EnsureOnlyOneDefaultLanguage(ITranslation translationToAdd)
		{
			if ((translationToAdd.IsDefault) 
				&& (_translations.Any(t => t.Value.IsDefault)))
			{
				throw new Exception("Only one default langauge is allowed.");
			}
		}
开发者ID:ChristianWeyer,项目名称:myProducts-End-to-End,代码行数:8,代码来源:LanguageManager.cs


示例10: GetSimilarTranslations

 public IList<ITranslation> GetSimilarTranslations(
     ITranslation sourceTranslation, 
     IList<ITranslation> targetTranslations)
 {
     return targetTranslations
         .Where(translation => translation.Source.Id == sourceTranslation.Source.Id ||
             translation.Target.Id == sourceTranslation.Target.Id)
         .ToList();
 }
开发者ID:EugeneSqr,项目名称:VocabExt,代码行数:9,代码来源:SynonymSelector.cs


示例11: LoginPage

		public LoginPage(ILoginPageViewModel viewModel, ITranslation translation, IViewLocator viewLocator)
		{
			_viewModel = viewModel;
			_viewModel.NavigateToMainPageCommand = new Command(async () => await NavigateToMainPage());
			BindingContext = _viewModel;

			_translation = translation;
			_viewLocator = viewLocator;
		}
开发者ID:ChristianWeyer,项目名称:myProducts-End-to-End,代码行数:9,代码来源:LoginPage.cs


示例12: MapInfoAnnotation

 /// <summary>
 /// Creates a new map message.
 /// </summary>
 /// <param name="text">The message.</param>
 /// <param name="boundary">The boundary object.</param>
 /// <param name="translation">The map translation.</param>
 public MapInfoAnnotation(string text, IAnchor boundary, ITranslation translation)
     : base(text, null, translation)
 {
     // Validate the parameters.
     if (null == boundary) throw new ArgumentNullException("boundary");
     if (null == translation) throw new ArgumentNullException("translation");
     // Set the annotation defaults.
     this.BackgroundColor = Color.White;
     this.Visible = false;
     // Set the boundary anchor.
     this.boundary = boundary;
 }
开发者ID:alexbikfalvi,项目名称:DotNetApi,代码行数:18,代码来源:MapInfoAnnotation.cs


示例13: AddTranslationItemsFromList

 public static void AddTranslationItemsFromList(string category, ITranslation translation, IEnumerable<Tuple<string, object>> items)
 {
     Action<string, object, PropertyInfo> action = delegate(string item, object itemObj, PropertyInfo propertyInfo)
     {
         var value = (string)propertyInfo.GetValue(itemObj, null);
         if (AllowTranslateProperty(value))
         {
             translation.AddTranslationItem(category, item, propertyInfo.Name, value);
         }
     };
     ForEachItem(items, action);
 }
开发者ID:NoUsername,项目名称:gitextensions,代码行数:12,代码来源:TranslationUtl.cs


示例14: ArticleMasterPage

		public ArticleMasterPage(ITranslation translation, 
			IArticleMasterPageViewModel viewModel,
			IArticlesHubProxy articlesHub,
			IViewLocator viewLocator)
		{
			_translation = translation;
			_viewModel = viewModel;
			_articlesHub = articlesHub;
			_viewLocator = viewLocator;
			BindingContext = _viewModel;
			CreateUI();
			this.SetDefaultPadding();
		}
开发者ID:ChristianWeyer,项目名称:myProducts-End-to-End,代码行数:13,代码来源:ArticleMasterPage.cs


示例15: GetTranslation

 public static ITranslation GetTranslation(string translationName)
 {
     if (string.IsNullOrEmpty(translationName))
     {
         _translation = null;
     }
     else if (!translationName.Equals(_name))
     {
          _translation = TranslationSerializer.Deserialize(Path.Combine(GetTranslationDir(), translationName + ".xlf"));
     }
     _name = translationName;
     return _translation;
 }
开发者ID:NoUsername,项目名称:gitextensions,代码行数:13,代码来源:Translator.cs


示例16: RoleController

 public RoleController(IRoleService roleService,
     IModuleManager moduleManager,
     IPermissionManager permissionManager,
     IMenuService menuService,
     IRoleBelongsSystemService belongsSystemService,
     IAuthorizer authorizer, ITranslation translation,
     IRolePermissionsService rolePermissionsService)
 {
     _roleService = roleService;
     _moduleManager = moduleManager;
     _permissionManager = permissionManager;
     _menuService = menuService;
     _belongsSystemService = belongsSystemService;
     _authorizer = authorizer;
     _translation = translation;
     _rolePermissionsService = rolePermissionsService;
 }
开发者ID:ChuHaiQuan,项目名称:SSO_SITE,代码行数:17,代码来源:RoleController.cs


示例17: AddTranslationItem

        public static void AddTranslationItem(string category, object obj, string propName, ITranslation translation)
        {
            if (obj == null)
                return;

            var propertyInfo = obj.GetType().GetProperty(propName,
                BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static |
                BindingFlags.NonPublic | BindingFlags.SetProperty);
            if (propertyInfo == null)
            {
                return;
            }
            var value = propertyInfo.GetValue(obj, null) as string;
            if (value != null && AllowTranslateProperty(value))
            {
                translation.AddTranslationItem(category, propName, "Text", value);
            }
        }
开发者ID:qgppl,项目名称:gitextensions,代码行数:18,代码来源:TranslationUtl.cs


示例18: AccountController

 public AccountController(ISsoSetting ssoSetting, IAuthenticationService svcAuthentication, IAuthService svcAuth,
     IAuthorizationCodeManager authorizationCodeManager, 
     IClientVerifier clientVerifier,
     ITranslation translation,
     IAccountRegisterManager accountRegisterManager,
     IClientManager clientManager,
     IValidateCodeBuilder validateCodeBuilder,
     IAuthorizationCodeHolder authorizationCodeHolder)
 {
     _svcAuthentication = svcAuthentication;
     _svcAuth = svcAuth;
     _authorizationCodeManager = authorizationCodeManager;
     _clientVerifier = clientVerifier;
     _translation = translation;
     _accountRegisterManager = accountRegisterManager;
     _clientManager = clientManager;
     _validateCodeBuilder = validateCodeBuilder;
     _authorizationCodeHolder = authorizationCodeHolder;
     _ssoSetting = ssoSetting;
     Logger =NullLogger.Instance;
 }
开发者ID:ChuHaiQuan,项目名称:SSO_SITE,代码行数:21,代码来源:AccountController.cs


示例19: SaveTranslation

        public IManyToManyRelationship SaveTranslation(
            ITranslation translation, 
            out ServiceOperationAction action)
        {
            action = ServiceOperationAction.Update;
            if (!translationValidator.Validate(translation).Status)
            {
                throw new ValidationFailedException();
            }

            using (var context = ContextFactory.Build())
            {
                var targetTranslation = GetTranslation(translation.Id) ??
                                        GetTranslation(translation.Source.Id, translation.Target.Id);

                if (targetTranslation == null)
                {
                    targetTranslation = context.Translations.CreateObject<Translation>();
                    context.Translations.AddObject(targetTranslation);
                    action = ServiceOperationAction.Create;
                }
                else
                {
                    context.Attach(targetTranslation);
                    action = ServiceOperationAction.Update;
                }

                targetTranslation.Source = context.Words.Single(item => item.Id == translation.Source.Id);
                targetTranslation.Target = context.Words.Single(item => item.Id == translation.Target.Id);

                context.SaveChanges();
                // TODO: to factory
                return new ManyToManyRelationship
                                        {
                                            Id = targetTranslation.Id,
                                            SourceId = targetTranslation.SourceId,
                                            TargetId = targetTranslation.TargetId
                                        };
            }
        }
开发者ID:EugeneSqr,项目名称:VocabExt,代码行数:40,代码来源:TranslationsRepository.cs


示例20: AddTranslationItemsFromList

        public static void AddTranslationItemsFromList(string category, ITranslation translation, IEnumerable<Tuple<string, object>> items)
        {
            foreach (var item in items)
            {
                var itemName = item.Item1;
                var itemObj = item.Item2;
                foreach (var property in GetItemPropertiesEnumerator(item))
                {
                    var value = property.GetValue(itemObj, null);
                    if (value == null)
                        continue;
                    var valueStr = value as string;
                    if (valueStr != null)
                    {
                        if (AllowTranslateProperty(valueStr))
                        {
                            translation.AddTranslationItem(category, itemName, property.Name, valueStr);
                        }
                        continue;
                    }

                    var listItems = value as IList;
                    if (listItems != null)
                    {
                        for (int index = 0; index < listItems.Count; index++)
                        {
                            var listItem = listItems[index] as string;
                            if (AllowTranslateProperty(listItem))
                            {
                                translation.AddTranslationItem(category, itemName, "Item" + index, listItem);
                            }
                        }
                    }
                }
            }
        }
开发者ID:qgppl,项目名称:gitextensions,代码行数:36,代码来源:TranslationUtl.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ITranslator类代码示例发布时间:2022-05-24
下一篇:
C# ITransition类代码示例发布时间: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