Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PortableObjectStringLocalizer simpler for inheritance #9569

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public PortableObjectStringLocalizer(
}

/// <inheritdocs />
public LocalizedString this[string name]
public virtual LocalizedString this[string name]
{
get
{
Expand All @@ -53,7 +53,7 @@ public LocalizedString this[string name]
}

/// <inheritdocs />
public LocalizedString this[string name, params object[] arguments]
public virtual LocalizedString this[string name, params object[] arguments]
{
get
{
Expand All @@ -65,7 +65,7 @@ public LocalizedString this[string name]
}

/// <inheritdocs />
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
public virtual IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
{
var culture = CultureInfo.CurrentUICulture;

Expand All @@ -78,7 +78,7 @@ public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
public IStringLocalizer WithCulture(CultureInfo culture) => this;

/// <inheritdocs />
public (LocalizedString, object[]) GetTranslation(string name, params object[] arguments)
public virtual (LocalizedString, object[]) GetTranslation(string name, params object[] arguments)
{
if (name == null)
{
Expand Down Expand Up @@ -150,7 +150,7 @@ private IEnumerable<LocalizedString> GetAllStringsFromCultureHierarchy(CultureIn
return allLocalizedStrings;
}

private string GetTranslation(string[] pluralForms, CultureInfo culture, int? count)
protected string GetTranslation(string[] pluralForms, CultureInfo culture, int? count)
{
var dictionary = _localizationManager.GetDictionary(culture);

Expand All @@ -170,7 +170,7 @@ private string GetTranslation(string[] pluralForms, CultureInfo culture, int? co
return pluralForms[pluralForm];
}

private string GetTranslation(string name, string context, CultureInfo culture, int? count)
protected string GetTranslation(string name, string context, CultureInfo culture, int? count)
{
string translation = null;
try
Expand Down