-
-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathEmptyLocalizationCatalog.cs
More file actions
31 lines (25 loc) · 1.15 KB
/
EmptyLocalizationCatalog.cs
File metadata and controls
31 lines (25 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// <copyright file="EmptyLocalizationCatalog.cs" company="iT Engineering - Software Innovations">
// Copyright (c) Jan Klass. All rights reserved.
// </copyright>
using System;
using System.Globalization;
namespace FubarDev.FtpServer.Localization
{
/// <summary>A localization catalog that returns text as-is.</summary>
/// <remarks>
/// <para>The texts in-code are written in English, so the effectively serves as an English catalog by returning texts as-is.</para>
/// <para>The culture formatting for values still applies though.</para>
/// </remarks>
public class EmptyLocalizationCatalog : ILocalizationCatalog
{
public EmptyLocalizationCatalog(CultureInfo cultureInfo)
{
CultureInfo = cultureInfo ?? throw new ArgumentNullException(nameof(cultureInfo));
FormatProvider = cultureInfo;
}
public CultureInfo CultureInfo { get; }
public IFormatProvider FormatProvider { get; }
public virtual string GetString(string text) => text;
public virtual string GetString(string text, params object?[] args) => string.Format(FormatProvider, text, args);
}
}