public DefaultStringReader(ICultureProvider culture, ICultureSet set, ITranslator translator, ITranslatedCaching cache) { this.culture = culture; this.set = set; this.translator = translator; this.cache = cache; }
public AccountController(ISettingsProvider settingsProvider, IAccountProvider accountProvider, IDownloadProvider downloadProvider, ICountryProvider countryProvider, ILicenceProvider licenceProvider, IUserCultureChangeProvider userCultureChanged, ICultureProvider cultureProvider, IPluginHelperService pluginHelperService) { _settingsProvider = settingsProvider ?? throw new ArgumentNullException(nameof(settingsProvider)); _accountProvider = accountProvider ?? throw new ArgumentNullException(nameof(accountProvider)); _downloadProvider = downloadProvider ?? throw new ArgumentNullException(nameof(downloadProvider)); _licenceProvider = licenceProvider ?? throw new ArgumentNullException(nameof(licenceProvider)); _userCultureChanged = userCultureChanged ?? throw new ArgumentNullException(nameof(userCultureChanged)); _cultureProvider = cultureProvider ?? throw new ArgumentNullException(nameof(cultureProvider)); if (countryProvider == null) { throw new ArgumentNullException(nameof(countryProvider)); } if (Countries == null) { Countries = countryProvider.GetVisibleCountries(); } if (LicenceTypes == null) { LicenceTypes = _licenceProvider.LicenceTypesGet(); } _blogLoaded = pluginHelperService.PluginLoaded("Blog.Plugin.dll", out _); }
/// <summary> /// Creates new instance where <paramref name="defaultCultureProvider"/> provides enumeration of default cultures /// </summary> /// <param name="defaultCultureProvider">Provider of default (application) cultures.</param> /// <param name="readerProvider">Provider of readers for other cultures.</param> public GetTextTranslationReaderProvider(ICultureProvider defaultCultureProvider, ITranslationReaderProvider readerProvider) { Ensure.NotNull(defaultCultureProvider, "defaultCultureProvider"); Ensure.NotNull(readerProvider, "readerProvider"); this.defaultCultureProvider = defaultCultureProvider; this.readerProvider = readerProvider; }
public DefaultStringReader(ICultureProvider culture, ICultureSet set, ITranslator translator, ITranslatedCaching cache) { this.culture = culture; this.set = set; this.translator = translator; this.cache = cache; }
/// <summary> /// Creates new instance that reads culture from <paramref name="cultureProvider"/>. /// </summary> /// <param name="cultureProvider">Provider for user culture.</param> /// <param name="readerProvider">Translations provider.</param> public TranslationAdapter(ICultureProvider cultureProvider, ITranslationReaderProvider readerProvider) { Ensure.NotNull(cultureProvider, "cultureProvider"); Ensure.NotNull(readerProvider, "readerProvider"); this.cultureProvider = cultureProvider; this.readerProvider = readerProvider; }
public RecipePersistenceService(IMvxSqliteConnectionFactory connectionFactory, ICultureProvider cultureProvider, IReferenceBookService referenceBook, DatabaseSettings settings) { if (connectionFactory == null) { throw new ArgumentNullException(nameof(connectionFactory)); } if (cultureProvider == null) { throw new ArgumentNullException(nameof(cultureProvider)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (referenceBook == null) { throw new ArgumentNullException(nameof(referenceBook)); } _referenceBook = referenceBook; var config = new SqLiteConfig(settings.DatabaseName, serializer: new JsonBlobSerializer()); _connection = connectionFactory.GetConnectionWithLock(config); _queryParser = new QueryParser(cultureProvider); }
public QueryParser(ICultureProvider cultureProvider) { if (cultureProvider == null) { throw new ArgumentNullException(nameof(cultureProvider)); } _cultureProvider = cultureProvider; }
public UpdateContext(ICultureProvider cultureProvider, IRecipePersistenceService recipePersistenceService, IReferenceBookService referenceBook) { CultureProvider = cultureProvider; RecipePersistenceService = recipePersistenceService; ReferenceBook = referenceBook; }
/// <summary> /// Defines a culture provider for the session contexts to be used by the instance of <see cref="TextProcessor"/> for the current <see cref="TextcMessageReceiver"/>. /// </summary> /// <param name="cultureProvider">The culture provider instance.</param> /// <returns></returns> public TextcMessageReceiverBuilder WithCultureProvider(ICultureProvider cultureProvider) { if (cultureProvider == null) { throw new ArgumentNullException(nameof(cultureProvider)); } _cultureProvider = cultureProvider; return(this); }
/// <summary> /// Initializes a new instance of the <see cref="TextcMessageReceiverBuilder"/> class. /// </summary> /// <param name="clientBuilder">The client builder.</param> /// <param name="outputProcessor">The output processor.</param> /// <param name="syntaxParser">The syntax parser.</param> /// <param name="expressionScorer">The expression scorer.</param> /// <param name="cultureProvider">The culture provider.</param> public TextcMessageReceiverBuilder( MessagingHubClientBuilder clientBuilder, IOutputProcessor outputProcessor = null, ISyntaxParser syntaxParser = null, IExpressionScorer expressionScorer = null, ICultureProvider cultureProvider = null) : this(clientBuilder.Build(), outputProcessor, syntaxParser, expressionScorer, cultureProvider) { }
public ContextProvider(ICultureProvider cultureProvider, TimeSpan contextValidity, string cacheName = nameof(ContextProvider)) { if (cultureProvider == null) { throw new ArgumentNullException(nameof(cultureProvider)); } _cultureProvider = cultureProvider; _contextCache = new MemoryCache(cacheName); _cacheItemPolicy = new CacheItemPolicy() { SlidingExpiration = contextValidity }; }
/// <summary> /// Initializes a new instance of the <see cref="TextcMessageReceiverBuilder"/> class. /// </summary> /// <param name="sender">The sender.</param> /// <param name="outputProcessor">The output processor.</param> /// <param name="syntaxParser">The syntax parser.</param> /// <param name="expressionScorer">The expression scorer.</param> /// <param name="cultureProvider">The culture provider.</param> public TextcMessageReceiverBuilder( IMessagingHubSender sender, IOutputProcessor outputProcessor = null, ISyntaxParser syntaxParser = null, IExpressionScorer expressionScorer = null, ICultureProvider cultureProvider = null) { _sender = sender; _outputProcessor = outputProcessor ?? new MessageOutputProcessor(sender); _syntaxParser = syntaxParser ?? new SyntaxParser(); _expressionScorer = expressionScorer ?? new RatioExpressionScorer(); _cultureProvider = cultureProvider ?? new DefaultCultureProvider(CultureInfo.InvariantCulture); _commandProcessorFactories = new List <Func <IOutputProcessor, ICommandProcessor> >(); _textPrePreprocessors = new List <ITextPreprocessor>(); }
public SearchService(IMvxSqliteConnectionFactory connectionFactory, ICultureProvider cultureProvider, DatabaseSettings settings) { if (connectionFactory == null) { throw new ArgumentNullException(nameof(connectionFactory)); } if (cultureProvider == null) { throw new ArgumentNullException(nameof(cultureProvider)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _cultureProvider = cultureProvider; _parser = new QueryParser(cultureProvider); var config = new SqLiteConfig(settings.DatabaseName, serializer: new JsonBlobSerializer()); _connection = connectionFactory.GetConnectionWithLock(config); }
public static void SetProvider(ICultureProvider value) { _current = value; }
/// <summary> /// Initializes a new instance of the <see cref="CultureService"/> class. /// </summary> /// <param name="cultureProvider">The culture provider.</param> public CultureService(ICultureProvider cultureProvider) { this.cultureProvider = cultureProvider; }
public async Task <IActionResult> Profile(Profile Model, string _name, string _position, string _selfIntroduce, IFormFile Avatar, [FromServices] ICultureProvider cultureProvider) { var key = cultureProvider.DetermineCulture(); Model.AvatarId = Startup.Profile.AvatarId; Model.Name = Startup.Profile.Name; Model.Position = Startup.Profile.Position; Model.SelfIntroduce = Startup.Profile.SelfIntroduce; if (Model.Name.ContainsKey(key)) { Model.Name.Remove(key); } if (Model.Position.ContainsKey(key)) { Model.Position.Remove(key); } if (Model.SelfIntroduce.ContainsKey(key)) { Model.SelfIntroduce.Remove(key); } Model.Name.Add(key, _name); Model.Position.Add(key, _position); Model.SelfIntroduce.Add(key, _selfIntroduce); if (Avatar != null && Avatar.Length > 0) { var blob = new Pomelo.AspNetCore.Extensions.BlobStorage.Models.Blob { Bytes = await Avatar.ReadAllBytesAsync(), FileName = Avatar.FileName, ContentLength = Avatar.Length, Time = DateTime.Now, ContentType = Avatar.ContentType }; DB.Blobs.Add(blob); DB.SaveChanges(); Model.AvatarId = blob.Id; } Startup.Profile = Model; System.IO.File.WriteAllText("profile.json", JsonConvert.SerializeObject(Model)); return(Prompt(x => { x.Title = SR["Succeeded"]; x.Details = SR["Your profile has been saved successfully."]; })); }
/// <summary> /// Initializes a new instance of the <see cref="CultureService"/> class. /// </summary> /// <param name="cultureProvider">The culture provider.</param> public CultureService(ICultureProvider cultureProvider) { this.cultureProvider = cultureProvider; }
public IActionResult Current([FromServices] ICultureProvider _cultureProvider) { return(Content(_cultureProvider.DetermineCulture())); }
//Sets the culture for a given web request. This selection process opts for picking the user's most preferred //language as specified in their browser, but has multiple fallbacks in cases where an appropriate translation //could not be found. public CultureSelector(ICFVConfiguration config, ICultureProvider cultureProvider) { _config = config; _cultureProvider = cultureProvider; }
public static void SetProvider(ICultureProvider value) { _current = value; }
public static bool BindCultureToResourceMap(this FrameworkElement frameworkElement, object key, ICultureProvider cultureProvider) { if (BindCultureExceptionCheck(frameworkElement, key, cultureProvider) is Exception ex) { throw ex; } return(frameworkElement.Resources[key] is ResourceMapBase resourceMap && !resourceMap.BindToCultureProvider(cultureProvider).HasError); }
public Validator(ICultureProvider cultureProvider) { _cultureProvider = cultureProvider; _errors = new List <Message>(); }
public ValidatorFactory(ICultureProvider cultureProvider) { this._cultureProvider = cultureProvider; }
public static void BindCultureToAllResourceMaps(this FrameworkElement frameworkElement, ICultureProvider cultureProvider) { if (frameworkElement == null) { throw new ArgumentNullException(nameof(frameworkElement)); } if (cultureProvider == null) { throw new ArgumentNullException(nameof(cultureProvider)); } foreach (ResourceMapBase resourceMap in frameworkElement.Resources.OfType <ResourceMapBase>()) { resourceMap.BindToCultureProvider(cultureProvider); } }
/// <summary> /// Инициализирует новый экземпляр класса. /// </summary> public GrooveMusicService(ICultureProvider cultureProvider) { _client = new XboxMusicServiceClient(CLIENT_NAME, CLIENT_SECRET); Region = cultureProvider.GetRegionInfo(); }