コード例 #1
0
ファイル: Localizer.cs プロジェクト: PenguinF/sandra-three
 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
ファイル: Localizer.cs プロジェクト: PenguinF/sandra-three
 /// <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
ファイル: PType.Base.cs プロジェクト: PenguinF/sandra-three
 public BaseType(LocalizedStringKey expectedTypeDescriptionKey, GreenJsonValueSyntaxVisitor <Maybe <TValue> > converter)
 {
     typeError      = new PTypeErrorBuilder(expectedTypeDescriptionKey);
     this.converter = converter;
 }