/// <summary> /// Create a new language /// </summary> /// <param name="culture">Language to create</param> /// <param name="sourceCulture">Language used as a template.</param> /// <remarks> /// Will add empty entries for all known entries. Entries are added automatically to the default language when views /// are visited. This is NOT done for any other language. /// </remarks> public void CreateForLanguage(CultureInfo culture, CultureInfo sourceCulture) { var prompts = new TextPromptCollection(culture); var sourcePrompts = GetLanguage(sourceCulture); if (sourcePrompts != null) prompts.AddRange(sourcePrompts.Select(p => new TextPrompt(p) { TranslatedText = "" })); SaveLanguage(culture, prompts); lock (_languages) { _languages[culture] = prompts; } }
protected TextPromptCollection LoadLanguage(CultureInfo culture) { var filename = GetFullPath(culture); if (!File.Exists(filename)) return null; using (var stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { var prompts = new TextPromptCollection(culture); var items = Deserialize(stream); prompts.AddRange(items); return prompts; } }