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