Exemple #1
0
 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();
            }
Exemple #3
0
 public override string Localize(LocalizedStringKey localizedStringKey, string[] parameters)
 => Dictionary.TryGetValue(localizedStringKey, out string displayText)
     ? StringUtilities.ConditionalFormat(displayText, parameters)
     : Default.Localize(localizedStringKey, parameters);
Exemple #4
0
 /// <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;
Exemple #6
0
 /// <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);
Exemple #7
0
 public LocalizedString(LocalizedStringKey key)
     : base(key)
 {
     DisplayText.Value = GetText();
     Session.Current.CurrentLocalizerChanged += Localizer_CurrentChanged;
 }
Exemple #8
0
 public static ITextProvider ToTextProvider(this LocalizedStringKey key)
 => key == null ? null : new LocalizedTextProvider(key);
Exemple #9
0
 public BaseType(LocalizedStringKey expectedTypeDescriptionKey, GreenJsonValueSyntaxVisitor <Maybe <TValue> > converter)
 {
     typeError      = new PTypeErrorBuilder(expectedTypeDescriptionKey);
     this.converter = converter;
 }