Skip to content

Commit

Permalink
Merge pull request #27 from AndrewKeepCoding/25-optionsuseuidwhenloca…
Browse files Browse the repository at this point in the history
…lizedstringnotfound-does-not-work-with-uid-on-xaml

Remove UseUidWhenLocalizedStringNotFound from Options
  • Loading branch information
AndrewKeepCoding authored Sep 12, 2023
2 parents 52f19dc + 827b0a8 commit 65821b2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Add this ItemGroup in the project file (\*.csproj) of your app.
.SetOptions(options =>
{
options.DefaultLanguage = "en-US";
options.UseUidWhenLocalizedStringNotFound = true;
})
.Build();
}
Expand Down Expand Up @@ -89,7 +88,6 @@ Add this ItemGroup in the project file (\*.csproj) of your app.
.SetOptions(options =>
{
options.DefaultLanguage = "en-US";
options.UseUidWhenLocalizedStringNotFound = true;
})
.Build();
}
Expand Down
2 changes: 0 additions & 2 deletions WinUI3Localizer.SampleApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ private static IHost BuildHost()
// .SetOptions(options =>
// {
// options.DefaultLanguage = "ja";
// options.UseUidWhenLocalizedStringNotFound = true;
// })
// .Build()
// .GetAwaiter()
Expand Down Expand Up @@ -141,7 +140,6 @@ private async Task InitializeLocalizer()
.SetOptions(options =>
{
options.DefaultLanguage = "en-US";
options.UseUidWhenLocalizedStringNotFound = true;
})
//.AddLocalizationAction(new LocalizationActionItem(typeof(Hyperlink), arguments =>
//{
Expand Down
4 changes: 1 addition & 3 deletions WinUI3Localizer/Localizer.Options.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
namespace WinUI3Localizer;
namespace WinUI3Localizer;

public partial class Localizer
{
public class Options
{
public string DefaultLanguage { get; set; } = "en-US";

public bool UseUidWhenLocalizedStringNotFound { get; set; } = false;

public bool DisableDefaultLocalizationActions { get; set; } = false;
}
}
8 changes: 2 additions & 6 deletions WinUI3Localizer/Localizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ public string GetLocalizedString(string uid)
throw localizerException;
}

return this.options.UseUidWhenLocalizedStringNotFound is true
? uid
: string.Empty;
return string.Empty;
}

public IEnumerable<string> GetLocalizedStrings(string uid)
Expand Down Expand Up @@ -147,9 +145,7 @@ public IEnumerable<string> GetLocalizedStrings(string uid)
throw localizerException;
}

return this.options.UseUidWhenLocalizedStringNotFound is true
? new string[] { uid }
: Array.Empty<string>();
return Array.Empty<string>();
}

public LanguageDictionary GetCurrentLanguageDictionary() => CurrentDictionary;
Expand Down

0 comments on commit 65821b2

Please sign in to comment.