public ILocalization Build() { if (LocaleLoader == null) { throw new LocalizerException("There is no loader configured for this localisation."); } if (DefaultLocale != null && !LocaleLoader.Supports(DefaultLocale)) { throw new LocalizerException($"The specified default locale \"{DefaultLocale}\" does not exist."); } return(new DefaultLocalization(LocaleLoader, ScriptOptions, DefaultLocale)); }
private IEnumerable <Locales> GetLocales(string modFolder) { string dowPath = this.filePathProvider.SoulstormLocation; string localePath = Path.Combine(dowPath, modFolder, "Locale", "English"); try { string[] files = Directory.GetFiles(localePath, "*.ucs", SearchOption.AllDirectories); var ucsLoader = new LocaleLoader(); return(files.Select(x => ucsLoader.Load(x))); } catch (DirectoryNotFoundException) { return(Enumerable.Empty <Locales>()); } }