public void AddLanguage(string language, ILocalisationStore storage) { locales.Add(new LocaleMapping { Name = language, Storage = storage }); configLocale.TriggerChange(); }
public string Format(ILocalisationStore store) { var localisedFormat = store.Get(Key); if (localisedFormat == null) { return(ToString()); } try { return(string.Format(store.EffectiveCulture, localisedFormat, Args)); } catch (FormatException e) { // The formatting has failed Logger.Log($"Localised format failed. Key: {Key}, culture: {store.EffectiveCulture.Name}, fallback format string: \"{Fallback}\", localised format string: \"{localisedFormat}\". Exception: {e}", LoggingTarget.Runtime, LogLevel.Verbose); } return(ToString()); }
public LocaleMapping(string name, ILocalisationStore storage) { Name = name; Storage = storage; }