public override string Localize(LocalizedStringKey localizedStringKey, string[] parameters) { if (localizedStringKey == null) { return(null); } return("{" + localizedStringKey.Key + StringUtilities.ToDefaultParameterListDisplayString(parameters) + "}"); }
public override string Localize(LocalizedStringKey localizedStringKey, string[] parameters) { if (localizedStringKey == JsonErrorInfoParameterDisplayHelper.NullString) { return(TestNullString); } if (localizedStringKey == JsonErrorInfoParameterDisplayHelper.UntypedObjectString) { return(StringUtilities.ConditionalFormat(TestUntypedObjectString, parameters)); } // Throw an exception here, no other keys should be used than above 2. throw new InvalidOperationException(); }
public override string Localize(LocalizedStringKey localizedStringKey, string[] parameters) => Dictionary.TryGetValue(localizedStringKey, out string displayText) ? StringUtilities.ConditionalFormat(displayText, parameters) : Default.Localize(localizedStringKey, parameters);
/// <summary> /// Initializes a new instance of <see cref="LocalizedTextProvider"/> with a specified <see cref="LocalizedStringKey"/>. /// </summary> /// <param name="key"> /// The <see cref="LocalizedStringKey"/> for the <see cref="LocalizedTextProvider"/>. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="key"/> is null. /// </exception> public LocalizedTextProvider(LocalizedStringKey key) { Key = key ?? throw new ArgumentNullException(nameof(key)); }
/// <summary> /// Initializes a new instance of <see cref="PTypeErrorBuilder"/>. /// </summary> /// <param name="expectedTypeDescriptionKey"> /// The translation key which describes the type of expected value. /// </param> public PTypeErrorBuilder(LocalizedStringKey expectedTypeDescriptionKey) => ExpectedTypeDescriptionKey = expectedTypeDescriptionKey;
/// <summary> /// Generates and formats a localized string given a <see cref="LocalizedStringKey"/> and an array of parameters. /// </summary> public abstract string Localize(LocalizedStringKey localizedStringKey, params string[] parameters);
public LocalizedString(LocalizedStringKey key) : base(key) { DisplayText.Value = GetText(); Session.Current.CurrentLocalizerChanged += Localizer_CurrentChanged; }
public static ITextProvider ToTextProvider(this LocalizedStringKey key) => key == null ? null : new LocalizedTextProvider(key);
public BaseType(LocalizedStringKey expectedTypeDescriptionKey, GreenJsonValueSyntaxVisitor <Maybe <TValue> > converter) { typeError = new PTypeErrorBuilder(expectedTypeDescriptionKey); this.converter = converter; }