Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
updated version to 1.0.3
  • Loading branch information
Jani Giannoudis committed Aug 31, 2023
1 parent 8fc026a commit 7a60472
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
41 changes: 23 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,30 @@ public interface ICultureProvider

In the REST application, the `ICultureProvider` service is set up at startup.
```csharp
private static void SetupLocalization(IServiceCollection services)
public static void Main(string[] args)
{
// culture
var scope = new CultureScope(
neutral: true,
specific: true,
installed: true,
custom: false,
replacement: false);
string[] supportedCultures = {
"en", "en-US", "en-GB",
"de", "de-DE", "de-AT", "de-CH",
"zh",
};
var cultureProvider = new CultureProvider(
supportedCultures: supportedCultures,
defaultCultureName: "en-US",
cultureScope: scope);
services.AddSingleton<ICultureProvider>(cultureProvider);
var builder = WebApplication.CreateBuilder(args);
...

// localization
// use AddLocalizationWithRequest() to register the request localization
builder.Services.AddLocalization(
cultureScope: new(
neutral: true,
specific: true,
installed: true,
custom: false,
replacement: false),
supportedCultures: new[]
{
"en", "en-US", "en-GB",
"de", "de-DE", "de-AT", "de-CH",
"zh",
},
defaultCulture: "en-US");

var app = builder.Build();
...
}
```

Expand Down
2 changes: 1 addition & 1 deletion RestApiLocalization/RestApiLocalization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<RootNamespace>RestApiLocalization</RootNamespace>
<Title>REST API Localization for .NET</Title>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<Authors>Jani Giannoudis</Authors>
<Copyright>(c) 2011-2023 by Jani Giannoudis, Switzerland</Copyright>
<Description>REST API Localization for .NET</Description>
Expand Down
2 changes: 1 addition & 1 deletion WebApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void Main(string[] args)
// localization
// use AddLocalizationWithRequest() to register the request localization
builder.Services.AddLocalization(
cultureScope: new CultureScope(
cultureScope: new(
neutral: true,
specific: true,
installed: true,
Expand Down

0 comments on commit 7a60472

Please sign in to comment.