private static void UpdateNameByLanguage(StreetNameListItem entity, Language?language, string name) { switch (language) { case Language.Dutch: entity.NameDutch = name; entity.NameDutchSearch = name.RemoveDiacritics(); break; case Language.French: entity.NameFrench = name; entity.NameFrenchSearch = name.RemoveDiacritics(); break; case Language.German: entity.NameGerman = name; entity.NameGermanSearch = name.RemoveDiacritics(); break; case Language.English: entity.NameEnglish = name; entity.NameEnglishSearch = name.RemoveDiacritics(); break; } }
private static void UpdateNameByLanguage(StreetNameName streetNameName, Language?language, string name) { switch (language) { default: case Language.Dutch: streetNameName.NameDutch = name; streetNameName.NameDutchSearch = name?.SanitizeForBosaSearch(); break; case Language.French: streetNameName.NameFrench = name; streetNameName.NameFrenchSearch = name?.SanitizeForBosaSearch(); break; case Language.German: streetNameName.NameGerman = name; streetNameName.NameGermanSearch = name?.SanitizeForBosaSearch(); break; case Language.English: streetNameName.NameEnglish = name; streetNameName.NameEnglishSearch = name?.SanitizeForBosaSearch(); break; } }
public static void Initialize(Language?language = null) { var entryDirectory = GetEntryDirectory() + "/"; Command.CommandManager.Changed += new EventHandler(CommandManager_Changed); FullPath = string.Empty; option = LoadOption(language); // Switch the language according to the loaded settings Language = Option.GuiLanguage; // Switch the culture according to the set language switch (Language) { case Language.English: Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); break; case Language.Japanese: Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP"); break; } New(); if (!DoExecuteWithMLBundle()) { InitializeScripts(entryDirectory); } }
private StreetNameNameWasCorrectedToCleared( Guid streetNameId, Language?language, ProvenanceData provenance) : this( new StreetNameId(streetNameId), language) => ((ISetProvenance)this).SetProvenance(provenance.ToProvenance());
private void UpdateHomoniemtv(StreetNameExtractItem streetName, Language?language, string homonymAddition) => UpdateRecord(streetName, record => { switch (language) { case Language.Dutch: streetName.HomonymDutch = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case Language.French: streetName.HomonymFrench = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case Language.German: streetName.HomonymGerman = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case Language.English: streetName.HomonymEnglish = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; case null: streetName.HomonymUnknown = homonymAddition?.Substring(0, Math.Min(homonymAddition.Length, 5)); break; default: throw new ArgumentOutOfRangeException(nameof(language), language, null); } });
private void UpdateStraatnm(StreetNameExtractItem streetName, Language?language, string name) => UpdateRecord(streetName, record => { switch (language) { case Language.Dutch: streetName.NameDutch = name; break; case Language.French: streetName.NameFrench = name; break; case Language.German: streetName.NameGerman = name; break; case Language.English: streetName.NameEnglish = name; break; case null: streetName.NameUnknown = name; break; default: throw new ArgumentOutOfRangeException(nameof(language), language, null); } });
public WatermarkPageModel(IConfigurationService configurationService) { this.configurationService = configurationService; GlobalCurrency = configurationService.GetGlobalCurrency(); DefaultLanguage = configurationService.GetDefaultLanguage(); }
private void AppendLanguage(Language?language) { if (language.HasValue && language.Value != Language.Undefined) { this.builder.AppendFormat(" +language:{0}", this.location.GetLanguage(language.Value)); } }
/// <summary> /// Get language set from browser cookie. /// </summary> /// <returns>Returns the language enum object if successful, null otherwise.</returns> public Language?GetLanguageFromCookie() { // default return value Language?result = null; try { // try to get user's preference from browser cookie HttpCookie languageCookie = HttpContext.Current.Request.Cookies["Language"]; // try to parse the cookie value if (languageCookie != null) { int dummy; // check if the cookie is an integer if (Int32.TryParse(languageCookie.Value, out dummy)) { // try to cast the integer value to the defined enum type Language result = (Language)dummy; } } } catch (Exception) { } return(result); }
/// <summary> /// Convert a given string to language enum object. /// </summary> /// <param name="value">The string which represents the language.</param> /// <returns>Returns the language enum object if string value is valid, null otherwise.</returns> public Language?Convert(string value) { Language?result = null; // get the query string (in case new language is selected if (value != null) { // convert to lower for easier, non-strict comparison value = value.ToLower(); switch (value) { case "en": case "english": result = Language.English; break; case "id": case "indonesian": result = Language.Indonesian; break; case "fr": case "french": result = Language.French; break; } } return(result); }
private void SwapLanguages() { var cl1 = _currentLanguage1; _currentLanguage1 = _currentLanguage2; _currentLanguage2 = cl1; _showOptionForBaseTerms = true; if (MyText is not null) { if (_currentLanguage1 is null) { _currentHeader = MyText.HeaderShowDashboardBase; } else { if (_currentLanguage1.Id == Const.PlLangId) { _currentHeader = MyText.HeaderShowDashboardBase; } else { _currentHeader = MyText.HeaderShowDashboardTrans; _showOptionForBaseTerms = false; } } } StateHasChanged(); GoSearch(); }
public Language?DetectIfRequired(string sourceCodeFileName, string sourceCode, Language[] languages = null) { Language?result = null; if ((languages?.Length ?? 0) == 1) { result = languages[0]; } else if (!string.IsNullOrEmpty(sourceCodeFileName)) { string[] extensions = GetExtensions(sourceCodeFileName); Language[] finalLanguages = GetLanguagesIntersection(extensions, languages); if (finalLanguages.Length == 1 || finalLanguages.Contains(Language.CSharp)) { result = finalLanguages[0]; } else if (finalLanguages.Length > 1) { result = Detect(sourceCode, finalLanguages); LogDetection(result, finalLanguages, sourceCodeFileName); } } else { result = Detect(sourceCode, languages); LogDetection(result, languages ?? LanguageExt.AllLanguages.GetLanguages(), sourceCodeFileName); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="ImportResult"/> struct. /// </summary> /// <param name="sequence"> /// The sequence. /// </param> /// <param name="language"> /// The language. /// </param> /// <param name="original"> /// The original. /// </param> /// <param name="translator"> /// The translator. /// </param> /// <param name="partial"> /// The partial. /// </param> /// <param name="precision"> /// The precision. /// </param> /// <param name="multisequenceName"> /// The multisequence name. /// </param> public ImportResult( CommonSequence sequence, Language?language, bool?original, Translator?translator, bool?partial, double?precision, string multisequenceName) { Matter matter = sequence.Matter; Name = matter.Name; Description = matter.Description; Nature = matter.Nature.GetDisplayValue(); Notation = sequence.Notation.GetDisplayValue(); Group = matter.Group.GetDisplayValue(); SequenceType = matter.SequenceType.GetDisplayValue(); RemoteId = sequence.RemoteId; Language = language?.GetDisplayValue(); Original = original; Translator = translator?.GetDisplayValue(); Partial = partial; Precision = precision; MultisequenceName = multisequenceName; MultisequenceNumber = matter.MultisequenceNumber; CollectionCountry = matter.CollectionCountry; CollectionDate = matter.CollectionDate; }
/// <summary> /// Updates the display name of a specified menu component to match the new data /// </summary> /// <param name="component">The <see cref="AMenuComponent"/> instance to be updated</param> /// <param name="language">The specified language</param> /// <returns></returns> internal static void Update(AMenuComponent component, Language?language = null) { var name = component.Name; try { var translation = GetTranslation(name, language); component.DisplayName = (from Match match in BracesAroundTextRegex.Matches(translation) select match.Groups).SelectMany( groups => { var list = new List <string>(groups.Count); for (int i = 0; i < groups.Count; i++) { list.Add(groups[i].Value); } return(list); }) .Aggregate( translation, (current, match) => current.Replace(match, Replacements[BraceFinderRegex.Replace(match, string.Empty)]())); } catch (KeyNotFoundException ex) { ex.Catch($"Couldn't translate {name}"); } catch (Exception ex) { ex.Catch(); } }
public TestForm(List<Word> words, Language? lang, bool revise, User user) { rand = new Random(); InitializeComponent(); CurrentUser = user; WordsToDo = words; PresetLanguage = lang; PresetRevise = revise; }
public ImdbMediaInfo(ImdbInfoProvider service, string id, string url, string imdbId, string title, string originalTitle, string outline, byte[] poster, int? year, string credits, float? rating, int? voteCount, int? runtime, Language? language, bool isTvShow, IEnumerable<string> genres, IDictionary<string, object> serviceIds) { _service = service; _id = id; _url = url; _imdbId = imdbId; _title = title; _originalTitle = originalTitle; _outline = outline; _poster = poster; _year = year; _credits = credits; _rating = rating; _voteCount = voteCount; _runtime = runtime; _language = language; _isTvShow = isTvShow; _genres = genres ?? Enumerable.Empty<string>(); _serviceIds = serviceIds ?? new Dictionary<string, object>(); }