private void InitLanguages() { const string DictionaryName = "Qocr.Dics"; var current = new DirectoryInfo(Directory.GetCurrentDirectory()); do { DirectoryInfo dicsDir = null; if (current.GetDirectories().Any(dic => (dicsDir = dic).Name == DictionaryName)) { foreach (var file in dicsDir.GetFiles("*.bin")) { var container = GetEulerContainer(file.FullName); foreach (var lang in container.Languages) { _eulerContainersCache.Add(lang.LocalizationName, container); Languages.Add(lang.LocalizationName); } } } current = current.Parent; if (current == null || !current.Exists) { break; } } while (true); }
internal void CreatePhoneNumbers(int count = 1) { for (int i = 0; i < count; i++) { Languages.Add(new Language()); } }
public Editor(string code, string language, List <System.Activities.Presentation.Model.ModelItem> Variables, string[] namespaces) { InitializeComponent(); var variables = new Dictionary <string, Type>(); foreach (var variableModel in Variables) { var variable = variableModel.GetCurrentValue() as System.Activities.LocationReference; if (variables.ContainsKey(variable.Name)) { System.Windows.MessageBox.Show("Editor: Doublecate variable " + variable.Name + " found. Try and avoid that if possible"); } else { variables.Add(variable.Name, variable.Type); } } if (!variables.ContainsKey("instance")) { variables.Add("instance", typeof(IWorkflowInstance)); } textEditor.Namespaces = namespaces; this.Variables = Variables; DataContext = this; //string[] names = typeof(ICSharpCode.AvalonEdit.AvalonEditCommands).Assembly.GetManifestResourceNames(); foreach (var hi in HighlightingManager.Instance.HighlightingDefinitions) { if (hi.Name == "VB" || hi.Name == "C#" || hi.Name == "PowerShell" || hi.Name == "Python") { Languages.Add(hi); } } // LoadFromResource("ICSharpCode.PythonBinding.Resources.Python.xshd", typeof(Editor)); LoadFromResource("Autohotkey.xshd", typeof(Editor)); textEditor.Text = code; if (language == "VB") { var header = CodeEditor.CodeEditor.GetVBHeaderText(variables, "Expression", namespaces); int numLines = header.Split('\n').Length; Log.Information("Header (add to line numbers): " + numLines); Title = "Editor (Add " + numLines + " to line numbers)"; } if (language == "C#") { var header = CodeEditor.CodeEditor.GetCSharpHeaderText(variables, "Expression", namespaces); int numLines = header.Split('\n').Length; Log.Information("Header (add to line numbers): " + numLines); Title = "Editor (Add " + numLines + " to line numbers)"; } textEditor.Variables = variables; textEditor.SyntaxHighlighting = Languages.Where(x => x.Name == language).FirstOrDefault(); // if (language == "C#") textEditor.Text = CodeEditor.CodeEditor.GetCSharpHeaderText(variables, "Expression", textEditor.Namespaces) + code + CodeEditor.CodeEditor.GetCSharpFooterText(); Button_Click(null, null); }
public ActionResult LanguagesAdd(BackEndLanguagesAdd backEndLanguagesAdd) { if (ModelState.IsValidOrRefresh()) { Languages languages = new Languages(); int? result = languages.Add(backEndLanguagesAdd.LanguageCode, backEndLanguagesAdd.LanguageName, backEndLanguagesAdd.LanguageNameOriginal, backEndLanguagesAdd.IsActive); switch (result) { case 0: ModelState.Clear(); backEndLanguagesAdd = new BackEndLanguagesAdd(); ModelState.AddResult(ViewData, ModelStateResult.Success, Resources.Strings.ItemSuccessfullyAdded); break; case 2: ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.LanguageCodeAlreadyExists); break; default: ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.UnexpectedError); break; } } return(View(backEndLanguagesAdd)); }
public LocalizationTablesUI() { Title = $"ME3Tweaks Mod Manager Localizer {Assembly.GetExecutingAssembly().GetName().Version}"; GlobalSupportedLanguages.AddRange(FullySupportedLangs); LoadCommands(); InitializeComponent(); // Load official languages Languages.Add(new LocalizationLanguage() { Selected = false, LangCode = "deu", FullName = "German" }); Languages.Add(new LocalizationLanguage() { Selected = false, LangCode = "rus", FullName = "Russian" }); Languages.Add(new LocalizationLanguage() { Selected = false, LangCode = "pol", FullName = "Polish" }); Languages.Add(new LocalizationLanguage() { Selected = false, LangCode = "bra", FullName = "Portugeuse (Brazilian)" }); //Load localizations LoadLocalizations(); }
private void LoadLanguages(string translationFolder) { if (!Directory.Exists(translationFolder)) { return; } Languages.Add(new CultureInfo("en-US")); foreach (var directory in Directory.EnumerateDirectories(translationFolder)) { if (!Directory.EnumerateFiles(directory, "*.mo", SearchOption.AllDirectories).Any()) { continue; } try { var cultureName = Path.GetFileName(directory); var cultureInfo = CultureInfo.GetCultureInfo(cultureName); Languages.Add(cultureInfo); } catch (CultureNotFoundException) { } } }
static Manager() { if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } string path = TaxonUtils.GetConfigFilePath(); if (Directory.Exists(path)) { string[] files = Directory.GetFiles(path); string prefix = Path.GetFileNameWithoutExtension(TaxonUtils.GetConfigFileName("language_")).ToLower(); foreach (string f in files) { string fname = Path.GetFileNameWithoutExtension(f).ToLower(); if (fname.StartsWith(prefix)) { fname = fname.Replace(prefix, ""); if (fname.Length == 2) { Languages.Add(fname); } } } } Languages.Load(); Languages.Save(); CurrentLanguage = Languages.GetDefault(); IsDirty = false; StartWatcher(); }
protected override void OnStartup(StartupEventArgs e) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); Configuration = builder.Build(); var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); ServiceProvider = serviceCollection.BuildServiceProvider(); LanguageChanged += App_LanguageChanged; Languages.Clear(); Languages.Add(new CultureInfo("en-US")); Languages.Add(new CultureInfo("ru-RU")); Language = LearningDataStorage.Properties.Settings.Default.DefaultLanguage; var mainWindow = ServiceProvider.GetRequiredService <MainWindow>(); mainWindow.Show(); }
private bool AddLanguageIfNotExistsOrAddExtensionsIfExists(Language language) { if (language.Extensions.All(ExtensionExists)) { return(false); } if (language.Extensions.Any(ExtensionExists)) { var extensionsToAdd = language.Extensions.Where(e => !ExtensionExists(e)); var existingExtension = language.Extensions.First(ExtensionExists); foreach (var extension in extensionsToAdd) { AddExtensionToExistingExtension(existingExtension, extension); } return(true); } if (!language.Extensions.Any(ExtensionExists)) { Languages.Add(language); return(true); } return(false); }
public Description(String id, DescriptionFontStyle fontStyle = default) { this.ID = id; if (Assets.Descriptions.TryGetValue(id, out var languages)) { foreach (var item in languages) { Languages.Add(item.Key, item.Value); } } else if (Assets.CustomDescriptions.TryGetValue(id, out languages)) { foreach (var item in languages) { Languages.Add(item.Key, item.Value); } } else { Languages.Add(Library.Languages.English, id); } if (Assets.Icons.ContainsKey(id)) { this.Icon = new Icon(Assets.Icons[id]); } this.FontStyle = fontStyle; }
public void Load([NotNull] XElement element) { Assert.ArgumentNotNull(element, nameof(element)); Name = element.GetAttributeValue("name"); Source = element.GetAttributeInt("source", 0); Mode = element.GetAttributeInt("mode", 0); RelatedItems = string.Compare(element.GetAttributeValue("related"), "true", StringComparison.InvariantCultureIgnoreCase) == 0; var languages = element.Element("languages"); if (languages != null) { foreach (var language in languages.Elements().Select(l => l.GetAttributeValue("name"))) { Languages.Add(language); } } var targets = element.Element("targets"); if (targets != null) { foreach (var target in targets.Elements().Select(t => t.GetAttributeValue("name"))) { Targets.Add(target); } } }
/// <summary> /// /// </summary> /// <param name="Code"></param> /// <param name="EnglishName"></param> private Language(string Code, string EnglishName) { this.Code = Code; this.EnglishName = EnglishName; Languages.Add(this); }
/// <summary> /// Adds a new language /// </summary> /// <remarks>Available for extensions</remarks> /// <param name="newLang"></param> /// <returns></returns> public static bool Add(InterfaceLanguage newLang) { if (newLang.Id.Length != 4) { return(false); } if (Languages == null) { Languages = new List <InterfaceLanguage>(); } foreach (InterfaceLanguage lang in Languages) { if (lang.Id == newLang.Id) { return(false); } } Languages.Add(newLang); if (FOnlineConfig.formMain != null) { FOnlineConfig.formMain.AddLanguage(newLang); } return(true); }
private void getConfig() { XmlDocument doc = new XmlDocument(); doc.Load(fileUri); foreach (XmlNode LanguageNode in doc["Config"]["Languages"].ChildNodes) { String languageName = LanguageNode.Attributes["name"].InnerText; String languageCode = LanguageNode.Attributes["code"].InnerText; Boolean languageSelected = (LanguageNode.Attributes["selected"].InnerText == "True") ? true : false; Languages.Add(languageName, languageSelected); Codes.Add(languageName, languageCode); if (languageSelected) { SelectedLanguage = languageName; } } MaxConnections = Int32.Parse(doc["Config"]["MaxConnections"].InnerText); QuestionBeforeConnection = (doc["Config"]["QuestionBeforeConnection"].InnerText == "True") ? true : false; MouseSensibility = Int32.Parse(doc["Config"]["MouseSensibility"].InnerText); ScrollSensibility = Int32.Parse(doc["Config"]["ScrollSensibility"].InnerText); }
public void AddLanguage(string langClsName, List <KeyValuePair <string, string> > langAttributes) { if (Languages == null) { Languages = new List <SubtitleLanguage>(); } SubtitleLanguage subtitleLanguage = new SubtitleLanguage() { LanguageClassName = langClsName }; foreach (KeyValuePair <string, string> attribute in langAttributes) { //Name:KRCC; lang:kr-KR; SAMIType:CC; switch (attribute.Key.ToLower()) { case "name": subtitleLanguage.LanguageName = attribute.Value; break; case "lang": subtitleLanguage.LanguageCode = attribute.Value; break; case "samitype": subtitleLanguage.Type = attribute.Value; break; } } Languages.Add(subtitleLanguage);; }
private void LoadFiles() { _languages = new ObservableCollection <LingualModel>(); List <string> files = Directory.GetFiles("languages", "resources.*.xml").ToList(); foreach (string file in files) { try { XmlSerializer x = new XmlSerializer(typeof(LingualModel)); StreamReader reader = new StreamReader(file); LingualModel model = (LingualModel)x.Deserialize(reader); Languages.Add(model); if (model.Name == ProjectManager.Instance.CurrentProject.projectSettings.GlobalSettings.Language) { CurrentLanguage = model; } } catch (Exception exp) { } } // set by default if (CurrentLanguage == null) { CurrentLanguage = Languages[0]; } }
public App() { App.LanguageChanged += App_LanguageChanged; Languages.Clear(); Languages.Add(new CultureInfo("en-US")); Languages.Add(new CultureInfo("ru-RU")); }
/// <summary> /// Loads the Language Packs. Override this method to add your custom packs. /// </summary> public virtual void LoadLanguagePacks() { vxConsole.WriteLine("Starting Language Manager"); Languages.Add(new vxLanguagePackEnglishBase()); Languages.Add(new vxLanguagePackFrenchBase()); Languages.Add(new vxLanguagePackKoreanBase()); }
public void AddLanguage(string lang) { lock (Languages) { Languages.Add(lang, new Dictionary <string, string>()); changed.Add(lang); } }
public void SetCurrentLanguage(Language language) { if (!Languages.Any(l => l.Equals(language))) { Languages.Add(language); } CurrentLanguage = language; }
private void ReloadLanguages() { Languages.Clear(); foreach (var language in _languageService.Languages) { Languages.Add(language); } }
public async Task InitGuild(IGuild guild) { if (Languages.ContainsKey(guild.Id)) // If somehow InitGuild is called 2 times for the same guild we ignore it { return; } string guildIdStr = guild.Id.ToString(); if (await R.Db(dbName).Table("Guilds").GetAll(guildIdStr).Count().Eq(0).RunAsync <bool>(conn)) { await R.Db(dbName).Table("Guilds").Insert(R.HashMap("id", guildIdStr) .With("Prefix", "s.") .With("Language", "en") .With("Availability", defaultAvailability) ).RunAsync(conn); } dynamic json = await R.Db(dbName).Table("Guilds").Get(guildIdStr).RunAsync(conn); Languages.Add(guild.Id, (string)json.Language); Prefixs.Add(guild.Id, (string)json.Prefix); string availability = (string)json.Availability; if (availability == null) { Availability.Add(guild.Id, defaultAvailability); } else { string newAvailability = availability; while (newAvailability.Length < defaultAvailability.Length) { newAvailability += "1"; } Availability.Add(guild.Id, newAvailability); } string anonymize = (string)json.Anonymize; if (anonymize != null) { Anonymize.Add(guild.Id, bool.Parse(anonymize)); } else { Anonymize.Add(guild.Id, false); } string anime = (string)json.animeSubscription; if (anime != null && anime != "0") { AnimeSubscription.Add((await guild.GetTextChannelAsync(ulong.Parse(anime)), null)); } string nhentai = (string)json.nhentaiSubscription; if (nhentai != null && nhentai != "0") { NHentaiSubscription.Add((await guild.GetTextChannelAsync(ulong.Parse(nhentai)), Subscription.SubscriptionTags.ParseSubscriptionTags(json.nhentaiSubscriptionTags.ToObject <string[]>(), false))); } }
public void AddLanguage(string name, string id, Dictionary <string, string> indices) { Languages.Add(new InspectLanguage { LanguageId = id, LanguageName = name, Indices = indices }); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultIndexer"/> class. /// </summary> /// <param name="indexCreators">The index creators.</param> public DefaultIndexer(IEnumerable <IIndexCreator> indexCreators) { Languages = indexCreators.Where(x => x.GetType().Assembly != typeof(DefaultIndexer).Assembly).ToDictionary(x => x.Name); foreach (var Language in indexCreators.Where(x => x.GetType().Assembly == typeof(DefaultIndexer).Assembly && !Languages.ContainsKey(x.Name))) { Languages.Add(Language.Name, Language); } }
public override void AddDefaultLanguage() { Languages.Add(new Language() { IsFunctional = false, IsOO = true, Name = "Java" }); }
private void AddLanguageSelectOption(string text, string value) { SelectOptionViewModel selectOptionViewModel = new SelectOptionViewModel(text, value) { IsSelected = (value == SelectedCultureName) }; Languages.Add(selectOptionViewModel); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultStemmer"/> class. /// </summary> /// <param name="languages">The languages.</param> public DefaultStemmer(IEnumerable <IStemmerLanguage> languages) { Languages = languages.Where(x => x.GetType().Assembly != typeof(DefaultStemmer).Assembly).ToDictionary(x => x.ISOCode); foreach (var Language in languages.Where(x => x.GetType().Assembly == typeof(DefaultStemmer).Assembly && !Languages.ContainsKey(x.ISOCode))) { Languages.Add(Language.ISOCode, Language); } }
public override void AddDefaultLanguage() { Languages.Add(new Language() { IsFunctional = true, IsOO = true, Name = "TypeScript" }); }
public void AddLanguage(String _language) { if (Languages.Contains(_language)) { throw new Exception(@"not unique language of Guide."); } Languages.Add(_language); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultInflector"/> class. /// </summary> /// <param name="languages">The languages.</param> public DefaultInflector(IEnumerable <IInflectorLanguage> languages) { Languages = languages.Where(x => x.GetType().Assembly != typeof(DefaultInflector).Assembly).ToDictionary(x => x.Name); foreach (var Language in languages.Where(x => x.GetType().Assembly == typeof(DefaultInflector).Assembly && !Languages.ContainsKey(x.Name))) { Languages.Add(Language.Name, Language); } }