├── .NET 8 Blazor Web App ├── Localization-with-dynamic-culture │ ├── LocalizationSample.Client │ │ ├── LocalizationSample.Client.csproj │ │ ├── Pages │ │ │ ├── Counter.razor │ │ │ └── CultureSwitcher.razor │ │ ├── Program.cs │ │ ├── Resources │ │ │ ├── SfResources.Designer.cs │ │ │ ├── SfResources.ar.resx │ │ │ ├── SfResources.de.resx │ │ │ ├── SfResources.en-US.resx │ │ │ ├── SfResources.fr.resx │ │ │ ├── SfResources.resx │ │ │ └── SfResources.zh.resx │ │ ├── SyncfusionLocalizer.cs │ │ ├── _Imports.razor │ │ └── wwwroot │ │ │ ├── appsettings.Development.json │ │ │ └── appsettings.json │ ├── LocalizationSample.sln │ └── LocalizationSample │ │ ├── Components │ │ ├── App.razor │ │ ├── Layout │ │ │ ├── MainLayout.razor │ │ │ ├── MainLayout.razor.css │ │ │ ├── NavMenu.razor │ │ │ └── NavMenu.razor.css │ │ ├── Pages │ │ │ ├── Error.razor │ │ │ ├── Home.razor │ │ │ └── Weather.razor │ │ ├── Routes.razor │ │ └── _Imports.razor │ │ ├── LocalizationSample.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ ├── app.css │ │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ └── favicon.png └── Localization-with-static-culture │ ├── LocalizationSample.Client │ ├── LocalizationSample.Client.csproj │ ├── Pages │ │ └── Counter.razor │ ├── Program.cs │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── SyncfusionLocalizer.cs │ ├── _Imports.razor │ └── wwwroot │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ ├── LocalizationSample.sln │ └── LocalizationSample │ ├── Components │ ├── App.razor │ ├── Layout │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ └── NavMenu.razor.css │ ├── Pages │ │ ├── Error.razor │ │ ├── Home.razor │ │ └── Weather.razor │ ├── Routes.razor │ └── _Imports.razor │ ├── LocalizationSample.csproj │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── app.css │ ├── bootstrap │ ├── bootstrap.min.css │ └── bootstrap.min.css.map │ └── favicon.png ├── .NET5 Blazor Server App ├── Localization-with-dynamic-culture │ ├── .gitignore │ ├── App.razor │ ├── Controllers │ │ └── CultureController.cs │ ├── Data │ │ ├── WeatherForecast.cs │ │ └── WeatherForecastService.cs │ ├── Pages │ │ ├── Counter.razor │ │ ├── Error.razor │ │ ├── FetchData.razor │ │ ├── Index.razor │ │ └── _Host.cshtml │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── Shared │ │ ├── CultureSwitcher.razor │ │ ├── MainLayout.razor │ │ ├── NavMenu.razor │ │ ├── SurveyPrompt.razor │ │ └── SyncfusionLocalizer.cs │ ├── Startup.cs │ ├── SyncfusionServerLocalization.csproj │ ├── SyncfusionServerLocalization.sln │ ├── _Imports.razor │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ │ ├── css │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ └── fonts │ │ │ │ ├── open-iconic.eot │ │ │ │ ├── open-iconic.otf │ │ │ │ ├── open-iconic.svg │ │ │ │ ├── open-iconic.ttf │ │ │ │ └── open-iconic.woff │ │ └── site.css │ │ └── favicon.ico └── Localization-with-static-culture │ ├── App.razor │ ├── Data │ ├── WeatherForecast.cs │ └── WeatherForecastService.cs │ ├── LocalizationServerApp.csproj │ ├── LocalizationServerApp.sln │ ├── Pages │ ├── Counter.razor │ ├── Error.cshtml │ ├── FetchData.razor │ ├── Index.razor │ └── _Host.cshtml │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Resources │ ├── SfResources.Designer.cs │ ├── SfResources.ar.resx │ ├── SfResources.de.resx │ ├── SfResources.en-US.resx │ ├── SfResources.fr.resx │ ├── SfResources.resx │ └── SfResources.zh.resx │ ├── Shared │ ├── MainLayout.razor │ ├── NavMenu.razor │ ├── SurveyPrompt.razor │ └── SyncfusionLocalizer.cs │ ├── Startup.cs │ ├── _Imports.razor │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ └── favicon.ico ├── .NET5 Blazor WASM App ├── Localization-with-dynamic-culture │ ├── .gitignore │ ├── App.razor │ ├── Pages │ │ ├── Counter.razor │ │ ├── FetchData.razor │ │ └── Index.razor │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── Shared │ │ ├── CultureSwitcher.razor │ │ ├── MainLayout.razor │ │ ├── NavMenu.razor │ │ ├── SurveyPrompt.razor │ │ └── SyncfusionLocalizer.cs │ ├── SyncfusionWasmLocalization.csproj │ ├── SyncfusionWasmLocalization.sln │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── app.css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ │ ├── favicon.ico │ │ ├── index.html │ │ └── sample-data │ │ └── weather.json └── Localization-with-static-culture │ ├── Client │ ├── App.razor │ ├── LocalizationWASMSample.Client.csproj │ ├── Pages │ │ ├── Counter.razor │ │ ├── FetchData.razor │ │ └── Index.razor │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── Shared │ │ ├── MainLayout.razor │ │ ├── NavMenu.razor │ │ ├── SurveyPrompt.razor │ │ └── SyncfusionLocalizer.cs │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── app.css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ │ ├── favicon.ico │ │ └── index.html │ ├── LocalizationWASMSample.sln │ ├── Server │ ├── Controllers │ │ └── WeatherForecastController.cs │ ├── LocalizationWASMSample.Server.csproj │ ├── Pages │ │ ├── Error.cshtml │ │ ├── Error.cshtml.cs │ │ └── Shared │ │ │ └── _Layout.cshtml │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json │ └── Shared │ ├── LocalizationWASMSample.Shared.csproj │ └── WeatherForecast.cs ├── .NET6 Blazor Server App ├── Localization-with-dynamic-culture │ ├── App.razor │ ├── Controllers │ │ └── CultureController.cs │ ├── Data │ │ ├── WeatherForecast.cs │ │ └── WeatherForecastService.cs │ ├── LocalizationServer.csproj │ ├── LocalizationServer.sln │ ├── Pages │ │ ├── Counter.razor │ │ ├── Error.cshtml │ │ ├── Error.cshtml.cs │ │ ├── FetchData.razor │ │ ├── Index.razor │ │ ├── _Host.cshtml │ │ └── _Layout.cshtml │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── Shared │ │ ├── CultureSwitcher.razor │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ ├── NavMenu.razor.css │ │ ├── SurveyPrompt.razor │ │ └── SyncfusionLocalizer.cs │ ├── _Imports.razor │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ │ ├── css │ │ │ │ └── open-iconic-bootstrap.min.css │ │ │ │ └── fonts │ │ │ │ ├── open-iconic.eot │ │ │ │ ├── open-iconic.otf │ │ │ │ ├── open-iconic.svg │ │ │ │ ├── open-iconic.ttf │ │ │ │ └── open-iconic.woff │ │ └── site.css │ │ └── favicon.ico └── Localization-with-static-culture │ ├── App.razor │ ├── Data │ ├── WeatherForecast.cs │ └── WeatherForecastService.cs │ ├── LocalizationServerApp.csproj │ ├── LocalizationServerApp.sln │ ├── Pages │ ├── Counter.razor │ ├── Error.cshtml │ ├── Error.cshtml.cs │ ├── FetchData.razor │ ├── Index.razor │ ├── _Host.cshtml │ └── _Layout.cshtml │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Resources │ ├── SfResources.Designer.cs │ ├── SfResources.ar.resx │ ├── SfResources.de.resx │ ├── SfResources.en-US.resx │ ├── SfResources.fr.resx │ ├── SfResources.resx │ └── SfResources.zh.resx │ ├── Shared │ ├── MainLayout.razor │ ├── MainLayout.razor.css │ ├── NavMenu.razor │ ├── NavMenu.razor.css │ ├── SurveyPrompt.razor │ └── SyncfusionLocalizer.cs │ ├── _Imports.razor │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ └── favicon.ico ├── .NET6 Blazor WASM App ├── Localization-with-dynamic-culture │ ├── App.razor │ ├── LocalizationSample.csproj │ ├── LocalizationSample.sln │ ├── Pages │ │ ├── Counter.razor │ │ ├── FetchData.razor │ │ └── Index.razor │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── Shared │ │ ├── CultureSwitcher.razor │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ ├── NavMenu.razor.css │ │ ├── SurveyPrompt.razor │ │ └── SyncfusionLocalizer.cs │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── app.css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ │ ├── favicon.ico │ │ ├── icon-192.png │ │ ├── index.html │ │ └── sample-data │ │ └── weather.json └── Localization-with-static-culture │ ├── Client │ ├── App.razor │ ├── LocalizationWASMApp.Client.csproj │ ├── Pages │ │ ├── Counter.razor │ │ ├── FetchData.razor │ │ └── Index.razor │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── Shared │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ ├── NavMenu.razor.css │ │ ├── SurveyPrompt.razor │ │ └── SyncfusionLocalizer.cs │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── app.css │ │ ├── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── open-iconic │ │ │ ├── FONT-LICENSE │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ │ ├── favicon.ico │ │ ├── icon-192.png │ │ └── index.html │ ├── LocalizationWASMApp.sln │ ├── Server │ ├── Controllers │ │ └── WeatherForecastController.cs │ ├── LocalizationWASMApp.Server.csproj │ ├── Pages │ │ ├── Error.cshtml │ │ └── Error.cshtml.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── appsettings.Development.json │ └── appsettings.json │ └── Shared │ ├── LocalizationWASMApp.Shared.csproj │ └── WeatherForecast.cs ├── .NET8 MAUI Blazor App ├── Localization-with-dynamic-culture │ ├── App.xaml │ ├── App.xaml.cs │ ├── Components │ │ ├── Layout │ │ │ ├── CultureSwitcher.razor │ │ │ ├── MainLayout.razor │ │ │ ├── MainLayout.razor.css │ │ │ ├── NavMenu.razor │ │ │ └── NavMenu.razor.css │ │ ├── Pages │ │ │ ├── Counter.razor │ │ │ ├── Home.razor │ │ │ └── Weather.razor │ │ └── SyncfusionLocalizer.cs │ ├── LocalizationMauiBlazor.csproj │ ├── LocalizationMauiBlazor.csproj.user │ ├── LocalizationMauiBlazor.sln │ ├── LocalizationResources │ │ ├── SfResources.Designer.cs │ │ ├── SfResources.ar-AE.resx │ │ ├── SfResources.de.resx │ │ ├── SfResources.en-US.resx │ │ ├── SfResources.fr.resx │ │ ├── SfResources.resx │ │ └── SfResources.zh.resx │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── MauiProgram.cs │ ├── Platforms │ │ ├── Android │ │ │ ├── AndroidManifest.xml │ │ │ ├── MainActivity.cs │ │ │ ├── MainApplication.cs │ │ │ └── Resources │ │ │ │ └── values │ │ │ │ └── colors.xml │ │ ├── MacCatalyst │ │ │ ├── AppDelegate.cs │ │ │ ├── Entitlements.plist │ │ │ ├── Info.plist │ │ │ └── Program.cs │ │ ├── Tizen │ │ │ ├── Main.cs │ │ │ └── tizen-manifest.xml │ │ ├── Windows │ │ │ ├── App.xaml │ │ │ ├── App.xaml.cs │ │ │ ├── Package.appxmanifest │ │ │ └── app.manifest │ │ └── iOS │ │ │ ├── AppDelegate.cs │ │ │ ├── Info.plist │ │ │ └── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── AppIcon │ │ │ ├── appicon.svg │ │ │ └── appiconfg.svg │ │ ├── Fonts │ │ │ └── OpenSans-Regular.ttf │ │ ├── Images │ │ │ └── dotnet_bot.svg │ │ ├── Raw │ │ │ └── AboutAssets.txt │ │ └── Splash │ │ │ └── splash.svg │ ├── Routes.razor │ ├── _Imports.razor │ └── wwwroot │ │ ├── css │ │ ├── app.css │ │ └── bootstrap │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── favicon.png │ │ └── index.html └── Localization-with-static-culture │ ├── App.xaml │ ├── App.xaml.cs │ ├── Components │ ├── Layout │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ └── NavMenu.razor.css │ ├── Pages │ │ ├── Counter.razor │ │ ├── Home.razor │ │ └── Weather.razor │ └── SyncfusionLocalizer.cs │ ├── LocalizationMauiBlazor.csproj │ ├── LocalizationMauiBlazor.csproj.user │ ├── LocalizationMauiBlazor.sln │ ├── LocalizationResources │ ├── SfResources.Designer.cs │ ├── SfResources.de.resx │ └── SfResources.resx │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── MauiProgram.cs │ ├── Platforms │ ├── Android │ │ ├── AndroidManifest.xml │ │ ├── MainActivity.cs │ │ ├── MainApplication.cs │ │ └── Resources │ │ │ └── values │ │ │ └── colors.xml │ ├── MacCatalyst │ │ ├── AppDelegate.cs │ │ ├── Entitlements.plist │ │ ├── Info.plist │ │ └── Program.cs │ ├── Tizen │ │ ├── Main.cs │ │ └── tizen-manifest.xml │ ├── Windows │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── Package.appxmanifest │ │ └── app.manifest │ └── iOS │ │ ├── AppDelegate.cs │ │ ├── Info.plist │ │ └── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Resources │ ├── AppIcon │ │ ├── appicon.svg │ │ └── appiconfg.svg │ ├── Fonts │ │ └── OpenSans-Regular.ttf │ ├── Images │ │ └── dotnet_bot.svg │ ├── Raw │ │ └── AboutAssets.txt │ └── Splash │ │ └── splash.svg │ ├── Routes.razor │ ├── _Imports.razor │ └── wwwroot │ ├── css │ ├── app.css │ └── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── favicon.png │ └── index.html ├── .github └── workflows │ └── gitleaks.yaml ├── README.md ├── dynamic-output.png └── static-output.png /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample.Client/Pages/CultureSwitcher.razor: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @inject IJSRuntime JSRuntime 3 | @inject NavigationManager NavigationManager 4 | 5 | 11 | 12 | @code { 13 | private CultureInfo[] supportedCultures = new[] 14 | { 15 | new CultureInfo("en-US"), 16 | new CultureInfo("de"), 17 | new CultureInfo("fr"), 18 | new CultureInfo("ar"), 19 | new CultureInfo("zh") 20 | }; 21 | 22 | private CultureInfo Culture 23 | { 24 | get => CultureInfo.CurrentCulture; 25 | set 26 | { 27 | if (CultureInfo.CurrentCulture != value) 28 | { 29 | JSRuntime.InvokeVoidAsync("cultureInfo.set", value.Name); 30 | 31 | NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample.Client/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationSample.Client; 2 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 3 | using Microsoft.JSInterop; 4 | using Syncfusion.Blazor; 5 | using System.Globalization; 6 | 7 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 8 | builder.Services.AddSyncfusionBlazor(); 9 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 10 | Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY"); 11 | var host = builder.Build(); 12 | //Setting culture of the application 13 | var jsInterop = host.Services.GetRequiredService(); 14 | var result = await jsInterop.InvokeAsync("cultureInfo.get"); 15 | CultureInfo culture; 16 | if (result != null) 17 | { 18 | culture = new CultureInfo(result); 19 | } 20 | else 21 | { 22 | culture = new CultureInfo("en-US"); 23 | await jsInterop.InvokeVoidAsync("cultureInfo.set", "en-US"); 24 | } 25 | CultureInfo.DefaultThreadCurrentCulture = culture; 26 | CultureInfo.DefaultThreadCurrentUICulture = culture; 27 | await builder.Build().RunAsync(); 28 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample.Client/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationSample.Client 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | // To get the locale key from mapped resources file 8 | public string GetText ( string key ) 9 | { 10 | return this.ResourceManager.GetString(key); 11 | } 12 | 13 | // To access the resource file and get the exact value for locale key 14 | 15 | public System.Resources.ResourceManager ResourceManager 16 | { 17 | get 18 | { 19 | // Replace the ApplicationNamespace with your application name. 20 | return LocalizationSample.Client.Resources.SfResources.ResourceManager; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample.Client/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using LocalizationSample.Client 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample.Client/wwwroot/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample.Client/wwwroot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Components/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Components/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @using LocalizationSample.Client.Pages 2 | @inherits LayoutComponentBase 3 | 4 |
5 | 8 | 9 |
10 |
11 | 12 | About 13 |
14 | 15 |
16 | @Body 17 |
18 |
19 |
20 | 21 |
22 | An unhandled error has occurred. 23 | Reload 24 | 🗙 25 |
26 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Components/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 30 | 31 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Components/Pages/Home.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | Home 4 | 5 |

Hello, world!

6 | 7 | Welcome to your new app. 8 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Components/Routes.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Components/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using LocalizationSample 10 | @using LocalizationSample.Client 11 | @using LocalizationSample.Components 12 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/LocalizationSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationSample.Client; 2 | using LocalizationSample.Client.Pages; 3 | using LocalizationSample.Components; 4 | using Syncfusion.Blazor; 5 | 6 | var builder = WebApplication.CreateBuilder(args); 7 | 8 | // Add services to the container. 9 | builder.Services.AddRazorComponents() 10 | .AddInteractiveServerComponents() 11 | .AddInteractiveWebAssemblyComponents(); 12 | builder.Services.AddSyncfusionBlazor(); 13 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 14 | 15 | var app = builder.Build(); 16 | 17 | // Configure the HTTP request pipeline. 18 | if (app.Environment.IsDevelopment()) 19 | { 20 | app.UseWebAssemblyDebugging(); 21 | } 22 | else 23 | { 24 | app.UseExceptionHandler("/Error", createScopeForErrors: true); 25 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 26 | app.UseHsts(); 27 | } 28 | 29 | app.UseHttpsRedirection(); 30 | 31 | app.UseStaticFiles(); 32 | app.UseAntiforgery(); 33 | 34 | app.MapRazorComponents() 35 | .AddInteractiveServerRenderMode() 36 | .AddInteractiveWebAssemblyRenderMode() 37 | .AddAdditionalAssemblies(typeof(Counter).Assembly); 38 | 39 | app.Run(); 40 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET 8 Blazor Web App/Localization-with-dynamic-culture/LocalizationSample/wwwroot/favicon.png -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample.Client/LocalizationSample.Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | true 8 | Default 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | True 20 | True 21 | SfResources.resx 22 | 23 | 24 | 25 | 26 | 27 | PublicResXFileCodeGenerator 28 | SfResources.Designer.cs 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample.Client/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationSample.Client; 2 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 3 | using Syncfusion.Blazor; 4 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 5 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 6 | builder.Services.AddSyncfusionBlazor(); 7 | 8 | await builder.Build().RunAsync(); -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample.Client/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationSample.Client 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | public string GetText ( string key ) 8 | { 9 | return this.ResourceManager.GetString(key); 10 | } 11 | 12 | public System.Resources.ResourceManager ResourceManager 13 | { 14 | get 15 | { 16 | // Replace the ApplicationNamespace with your application name. 17 | return LocalizationSample.Client.Resources.SfResources.ResourceManager; 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample.Client/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using LocalizationSample.Client 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample.Client/wwwroot/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample.Client/wwwroot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Components/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Components/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | 19 |
20 | An unhandled error has occurred. 21 | Reload 22 | 🗙 23 |
24 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Components/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 30 | 31 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Components/Pages/Home.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | Home 4 | 5 |

Hello, world!

6 | 7 | Welcome to your new app. 8 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Components/Routes.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Components/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using LocalizationSample 10 | @using LocalizationSample.Client 11 | @using LocalizationSample.Components 12 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/LocalizationSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationSample.Client; 2 | using LocalizationSample.Client.Pages; 3 | using LocalizationSample.Components; 4 | using Syncfusion.Blazor; 5 | using System.Globalization; 6 | 7 | var builder = WebApplication.CreateBuilder(args); 8 | 9 | // Add services to the container. 10 | builder.Services.AddRazorComponents() 11 | .AddInteractiveServerComponents() 12 | .AddInteractiveWebAssemblyComponents(); 13 | builder.Services.AddSyncfusionBlazor(); 14 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 15 | 16 | var app = builder.Build(); 17 | 18 | // Configure the HTTP request pipeline. 19 | if (app.Environment.IsDevelopment()) 20 | { 21 | app.UseWebAssemblyDebugging(); 22 | } 23 | else 24 | { 25 | app.UseExceptionHandler("/Error", createScopeForErrors: true); 26 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 27 | app.UseHsts(); 28 | } 29 | 30 | app.UseHttpsRedirection(); 31 | 32 | app.UseStaticFiles(); 33 | app.UseAntiforgery(); 34 | 35 | app.MapRazorComponents() 36 | .AddInteractiveServerRenderMode() 37 | .AddInteractiveWebAssemblyRenderMode() 38 | .AddAdditionalAssemblies(typeof(Counter).Assembly); 39 | 40 | app.Run(); -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET 8 Blazor Web App/Localization-with-static-culture/LocalizationSample/wwwroot/favicon.png -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | bin 3 | obj -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 |

Sorry, there's nothing at this address.

9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Controllers/CultureController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Localization; 4 | 5 | namespace SyncfusionServerLocalization.Controllers 6 | { 7 | [Route("[controller]/[action]")] 8 | public class CultureController : Controller 9 | { 10 | public IActionResult SetCulture(string culture, string redirectUri) 11 | { 12 | if (culture != null) 13 | { 14 | HttpContext.Response.Cookies.Append( 15 | CookieRequestCultureProvider.DefaultCookieName, 16 | CookieRequestCultureProvider.MakeCookieValue( 17 | new RequestCulture(culture))); 18 | } 19 | 20 | return LocalRedirect(redirectUri); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SyncfusionServerLocalization.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace SyncfusionServerLocalization.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/error" 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

12 | The Development environment shouldn't be enabled for deployed applications. 13 | It can result in displaying sensitive information from exceptions to end users. 14 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 15 | and restarting the app. 16 |

-------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using SyncfusionServerLocalization.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Hosting; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace SyncfusionServerLocalization 13 | { 14 | public class Program 15 | { 16 | public static void Main(string[] args) 17 | { 18 | CreateHostBuilder(args).Build().Run(); 19 | } 20 | 21 | public static IHostBuilder CreateHostBuilder(string[] args) => 22 | Host.CreateDefaultBuilder(args) 23 | .ConfigureWebHostDefaults(webBuilder => 24 | { 25 | webBuilder.UseStartup(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:14631", 7 | "sslPort": 44396 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "SyncfusionServerLocalization": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | 10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 |  11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Syncfusion.Blazor; 6 | namespace SyncfusionServerLocalization.Shared 7 | { 8 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 9 | { 10 | // To get the locale key from mapped resources file 11 | public string GetText(string key) 12 | { 13 | return this.ResourceManager.GetString(key); 14 | } 15 | 16 | // To access the resource file and get the exact value for locale key 17 | 18 | public System.Resources.ResourceManager ResourceManager 19 | { 20 | get 21 | { 22 | return SyncfusionServerLocalization.Resources.SfResources.ResourceManager; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/SyncfusionServerLocalization.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | True 15 | True 16 | SfResources.resx 17 | 18 | 19 | 20 | 21 | 22 | PublicResXFileCodeGenerator 23 | 24 | 25 | PublicResXFileCodeGenerator 26 | SfResources.Designer.cs 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/SyncfusionServerLocalization.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31911.196 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SyncfusionServerLocalization", "SyncfusionServerLocalization.csproj", "{874006A1-8025-44B2-B024-FA7F3DAD22EB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {874006A1-8025-44B2-B024-FA7F3DAD22EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {874006A1-8025-44B2-B024-FA7F3DAD22EB}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {874006A1-8025-44B2-B024-FA7F3DAD22EB}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {874006A1-8025-44B2-B024-FA7F3DAD22EB}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {96BB9C6B-1D1B-4930-9F89-3FC5CD72C522} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using SyncfusionServerLocalization 9 | @using SyncfusionServerLocalization.Shared 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-dynamic-culture/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 |

Sorry, there's nothing at this address.

9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LocalizationServerApp.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace LocalizationServerApp.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 18 | { 19 | Date = startDate.AddDays(index), 20 | TemperatureC = rng.Next(-20, 55), 21 | Summary = Summaries[rng.Next(Summaries.Length)] 22 | }).ToArray()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/LocalizationServerApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | True 15 | True 16 | SfResources.resx 17 | 18 | 19 | 20 | 21 | 22 | PublicResXFileCodeGenerator 23 | 24 | 25 | PublicResXFileCodeGenerator 26 | SfResources.Designer.cs 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/LocalizationServerApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31911.196 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizationServerApp", "LocalizationServerApp.csproj", "{7EF13A5D-250C-4BC1-8A20-15DD328765EF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7EF13A5D-250C-4BC1-8A20-15DD328765EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7EF13A5D-250C-4BC1-8A20-15DD328765EF}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7EF13A5D-250C-4BC1-8A20-15DD328765EF}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7EF13A5D-250C-4BC1-8A20-15DD328765EF}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {5D1E3491-057E-4855-AA84-97A040C16E3B} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

12 | The Development environment shouldn't be enabled for deployed applications. 13 | It can result in displaying sensitive information from exceptions to end users. 14 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 15 | and restarting the app. 16 |

17 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using LocalizationServerApp.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.Hosting; 5 | using Microsoft.Extensions.Logging; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Threading.Tasks; 11 | 12 | namespace LocalizationServerApp 13 | { 14 | public class Program 15 | { 16 | public static void Main(string[] args) 17 | { 18 | CreateHostBuilder(args).Build().Run(); 19 | } 20 | 21 | public static IHostBuilder CreateHostBuilder(string[] args) => 22 | Host.CreateDefaultBuilder(args) 23 | .ConfigureWebHostDefaults(webBuilder => 24 | { 25 | webBuilder.UseStartup(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:38501", 7 | "sslPort": 44357 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "LocalizationServerApp": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 |  11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationServerApp.Shared 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | // To get the locale key from mapped resources file 8 | public string GetText(string key) 9 | { 10 | return this.ResourceManager.GetString(key); 11 | } 12 | 13 | // To access the resource file and get the exact value for locale key 14 | public System.Resources.ResourceManager ResourceManager 15 | { 16 | get 17 | { 18 | // Replace the ApplicationNamespace with your application name. 19 | return LocalizationServerApp.Resources.SfResources.ResourceManager; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using LocalizationServerApp 9 | @using LocalizationServerApp.Shared 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor Server App/Localization-with-static-culture/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | bin/ 3 | obj/ -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:3740", 7 | "sslPort": 44349 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "SyncfusionWasmLocalization": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 23 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/Shared/CultureSwitcher.razor: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @inject IJSRuntime JSRuntime 3 | @inject NavigationManager NavigationManager 4 | 5 | 11 | 12 | @code { 13 | private CultureInfo[] supportedCultures = new[] 14 | { 15 | new CultureInfo("en-US"), 16 | new CultureInfo("de-DE"), 17 | new CultureInfo("fr-FR"), 18 | new CultureInfo("ar-AE"), 19 | new CultureInfo("zh-HK") 20 | }; 21 | 22 | private CultureInfo Culture 23 | { 24 | get => CultureInfo.CurrentCulture; 25 | set 26 | { 27 | if (CultureInfo.CurrentCulture != value) 28 | { 29 | var js = (IJSInProcessRuntime)JSRuntime; 30 | js.InvokeVoid("cultureInfo.set", value.Name); 31 | 32 | NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | 10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 |  11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Syncfusion.Blazor; 6 | 7 | namespace SyncfusionWasmLocalization.Shared 8 | { 9 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 10 | { 11 | // To get the locale key from mapped resources file 12 | public string GetText(string key) 13 | { 14 | return this.ResourceManager.GetString(key); 15 | } 16 | 17 | // To access the resource file and get the exact value for locale key 18 | 19 | public System.Resources.ResourceManager ResourceManager 20 | { 21 | get 22 | { 23 | // Replace the ApplicationNamespace with your application name. 24 | return SyncfusionWasmLocalization.Resources.SfResources.ResourceManager; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/SyncfusionWasmLocalization.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SyncfusionWasmLocalization", "SyncfusionWasmLocalization.csproj", "{919B9075-F4F5-4892-991E-3590AD85872B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {919B9075-F4F5-4892-991E-3590AD85872B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {919B9075-F4F5-4892-991E-3590AD85872B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {919B9075-F4F5-4892-991E-3590AD85872B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {919B9075-F4F5-4892-991E-3590AD85872B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {BBC42ADD-8708-4C5F-8F3E-25E5D3F671C2} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 7 | @using Microsoft.JSInterop 8 | @using SyncfusionWasmLocalization 9 | @using SyncfusionWasmLocalization.Shared 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | SyncfusionWasmLocalization 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Loading... 17 | 18 |
19 | An unhandled error has occurred. 20 | Reload 21 | 🗙 22 |
23 | 24 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2018-05-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2018-05-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2018-05-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2018-05-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @using LocalizationWASMSample.Shared 3 | @inject HttpClient Http 4 | 5 |

Weather forecast

6 | 7 |

This component demonstrates fetching data from the server.

8 | 9 | @if (forecasts == null) 10 | { 11 |

Loading...

12 | } 13 | else 14 | { 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | @foreach (var forecast in forecasts) 26 | { 27 | 28 | 29 | 30 | 31 | 32 | 33 | } 34 | 35 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
36 | } 37 | 38 | @code { 39 | private WeatherForecast[] forecasts; 40 | 41 | protected override async Task OnInitializedAsync() 42 | { 43 | forecasts = await Http.GetFromJsonAsync("WeatherForecast"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationWASMSample.Client.Shared; 2 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Logging; 6 | using Syncfusion.Blazor; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Globalization; 10 | using System.Net.Http; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | 14 | namespace LocalizationWASMSample.Client 15 | { 16 | public class Program 17 | { 18 | public static async Task Main(string[] args) 19 | { 20 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 21 | builder.RootComponents.Add("app"); 22 | 23 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 24 | 25 | builder.Services.AddSyncfusionBlazor(options => { options.IgnoreScriptIsolation = true; }); 26 | //Register the Syncfusion locale service to localize Syncfusion Blazor components. 27 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 28 | 29 | await builder.Build().RunAsync(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:33946", 7 | "sslPort": 44350 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "LocalizationWASMSample": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 23 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 |  11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 |  2 | using Syncfusion.Blazor; 3 | 4 | namespace LocalizationWASMSample.Client.Shared 5 | { 6 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 7 | { 8 | // To get the locale key from mapped resources file 9 | public string GetText(string key) 10 | { 11 | return this.ResourceManager.GetString(key); 12 | } 13 | 14 | // To access the resource file and get the exact value for locale key 15 | public System.Resources.ResourceManager ResourceManager 16 | { 17 | get 18 | { 19 | // Replace the ApplicationNamespace with your application name. 20 | return LocalizationWASMSample.Client.Resources.SfResources.ResourceManager; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 7 | @using Microsoft.JSInterop 8 | @using LocalizationWASMSample.Client 9 | @using LocalizationWASMSample.Client.Shared 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | LocalizationWASMSample 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Loading... 17 | 18 |
19 | An unhandled error has occurred. 20 | Reload 21 | 🗙 22 |
23 | 24 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/LocalizationWASMSample.Server.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model LocalizationWASMSample.Server.Pages.ErrorModel 3 | @{ 4 | Layout = "_Layout"; 5 | ViewData["Title"] = "Error"; 6 | } 7 | 8 |

Error.

9 |

An error occurred while processing your request.

10 | 11 | @if (Model.ShowRequestId) 12 | { 13 |

14 | Request ID: @Model.RequestId 15 |

16 | } 17 | 18 |

Development Mode

19 |

20 | Swapping to the Development environment displays detailed information about the error that occurred. 21 |

22 |

23 | The Development environment shouldn't be enabled for deployed applications. 24 | It can result in displaying sensitive information from exceptions to end users. 25 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 26 | and restarting the app. 27 |

28 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using Microsoft.Extensions.Logging; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace LocalizationWASMSample.Server.Pages 11 | { 12 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 13 | public class ErrorModel : PageModel 14 | { 15 | public string RequestId { get; set; } 16 | 17 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 18 | 19 | private readonly ILogger _logger; 20 | 21 | public ErrorModel(ILogger logger) 22 | { 23 | _logger = logger; 24 | } 25 | 26 | public void OnGet() 27 | { 28 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/Pages/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | @ViewBag.Title 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | @RenderBody() 16 |
17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | using Microsoft.Extensions.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace LocalizationWASMSample.Server 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:33946", 7 | "sslPort": 44350 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "LocalizationWASMSample.Server": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 23 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development" 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Server/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Shared/LocalizationWASMSample.Shared.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.NET5 Blazor WASM App/Localization-with-static-culture/Shared/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LocalizationWASMSample.Shared 6 | { 7 | public class WeatherForecast 8 | { 9 | public DateTime Date { get; set; } 10 | 11 | public int TemperatureC { get; set; } 12 | 13 | public string Summary { get; set; } 14 | 15 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Controllers/CultureController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Localization; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace LocalizationServer.Controllers 5 | { 6 | [Route("[controller]/[action]")] 7 | public class CultureController : Controller 8 | { 9 | public IActionResult SetCulture(string culture, string redirectUri) 10 | { 11 | if (culture != null) 12 | { 13 | HttpContext.Response.Cookies.Append( 14 | CookieRequestCultureProvider.DefaultCookieName, 15 | CookieRequestCultureProvider.MakeCookieValue( 16 | new RequestCulture(culture))); 17 | } 18 | 19 | return LocalRedirect(redirectUri); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationServer.Data 2 | { 3 | public class WeatherForecast 4 | { 5 | public DateTime Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationServer.Data 2 | { 3 | public class WeatherForecastService 4 | { 5 | private static readonly string[] Summaries = new[] 6 | { 7 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 8 | }; 9 | 10 | public Task GetForecastAsync(DateTime startDate) 11 | { 12 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 13 | { 14 | Date = startDate.AddDays(index), 15 | TemperatureC = Random.Shared.Next(-20, 55), 16 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 17 | }).ToArray()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/LocalizationServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | True 17 | True 18 | SfResources.resx 19 | 20 | 21 | 22 | 23 | 24 | PublicResXFileCodeGenerator 25 | 26 | 27 | PublicResXFileCodeGenerator 28 | SfResources.Designer.cs 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/LocalizationServer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizationServer", "LocalizationServer.csproj", "{45818072-D874-41BC-AAE1-5B1EEC0F2CAF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {45818072-D874-41BC-AAE1-5B1EEC0F2CAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {45818072-D874-41BC-AAE1-5B1EEC0F2CAF}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {45818072-D874-41BC-AAE1-5B1EEC0F2CAF}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {45818072-D874-41BC-AAE1-5B1EEC0F2CAF}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D65634D4-A30A-4355-BCDB-7118ECAAEA98} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using System.Diagnostics; 4 | 5 | namespace LocalizationServer.Pages 6 | { 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | Weather forecast 4 | 5 | @using LocalizationServer.Data 6 | @inject WeatherForecastService ForecastService 7 | 8 |

Weather forecast

9 | 10 |

This component demonstrates fetching data from a service.

11 | 12 | @if (forecasts == null) 13 | { 14 |

Loading...

15 | } 16 | else 17 | { 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | @foreach (var forecast in forecasts) 29 | { 30 | 31 | 32 | 33 | 34 | 35 | 36 | } 37 | 38 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
39 | } 40 | 41 | @code { 42 | private WeatherForecast[]? forecasts; 43 | 44 | protected override async Task OnInitializedAsync() 45 | { 46 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace LocalizationServer.Pages 3 | @using Microsoft.AspNetCore.Localization 4 | @using System.Globalization 5 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 6 | @{ 7 | Layout = "_Layout"; 8 | this.HttpContext.Response.Cookies.Append( 9 | CookieRequestCultureProvider.DefaultCookieName, 10 | CookieRequestCultureProvider.MakeCookieValue( 11 | new RequestCulture( 12 | CultureInfo.CurrentCulture, 13 | CultureInfo.CurrentUICulture))); 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:42815", 7 | "sslPort": 44364 8 | } 9 | }, 10 | "profiles": { 11 | "LocalizationServer": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:7194;http://localhost:5194", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | LocalizationServer 4 | 5 |
6 | 9 | 10 |
11 |
12 | 13 | About 14 |
15 | 16 |
17 | @Body 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationServer.Shared 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | // To get the locale key from mapped resources file 8 | public string GetText(string key) 9 | { 10 | return this.ResourceManager.GetString(key); 11 | } 12 | 13 | // To access the resource file and get the exact value for locale key 14 | 15 | public System.Resources.ResourceManager ResourceManager 16 | { 17 | get 18 | { 19 | // Replace the ApplicationNamespace with your application name. 20 | return LocalizationServer.Resources.SfResources.ResourceManager; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using LocalizationServer 10 | @using LocalizationServer.Shared 11 | @using Syncfusion.Blazor 12 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-dynamic-culture/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationServerApp.Data 2 | { 3 | public class WeatherForecast 4 | { 5 | public DateTime Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationServerApp.Data 2 | { 3 | public class WeatherForecastService 4 | { 5 | private static readonly string[] Summaries = new[] 6 | { 7 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 8 | }; 9 | 10 | public Task GetForecastAsync(DateTime startDate) 11 | { 12 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 13 | { 14 | Date = startDate.AddDays(index), 15 | TemperatureC = Random.Shared.Next(-20, 55), 16 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 17 | }).ToArray()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/LocalizationServerApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | True 17 | True 18 | SfResources.resx 19 | 20 | 21 | 22 | 23 | 24 | PublicResXFileCodeGenerator 25 | 26 | 27 | PublicResXFileCodeGenerator 28 | SfResources.Designer.cs 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/LocalizationServerApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizationServerApp", "LocalizationServerApp.csproj", "{A3B11B51-277C-471D-9AC4-DD596C401D57}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {A3B11B51-277C-471D-9AC4-DD596C401D57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {A3B11B51-277C-471D-9AC4-DD596C401D57}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {A3B11B51-277C-471D-9AC4-DD596C401D57}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {A3B11B51-277C-471D-9AC4-DD596C401D57}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {1D5C59B6-ACC1-4CDB-84E4-D928FF8302A6} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using System.Diagnostics; 4 | 5 | namespace LocalizationServerApp.Pages 6 | { 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | Weather forecast 4 | 5 | @using LocalizationServerApp.Data 6 | @inject WeatherForecastService ForecastService 7 | 8 |

Weather forecast

9 | 10 |

This component demonstrates fetching data from a service.

11 | 12 | @if (forecasts == null) 13 | { 14 |

Loading...

15 | } 16 | else 17 | { 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | @foreach (var forecast in forecasts) 29 | { 30 | 31 | 32 | 33 | 34 | 35 | 36 | } 37 | 38 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
39 | } 40 | 41 | @code { 42 | private WeatherForecast[]? forecasts; 43 | 44 | protected override async Task OnInitializedAsync() 45 | { 46 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace LocalizationServerApp.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = "_Layout"; 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationServerApp.Data; 2 | using LocalizationServerApp.Shared; 3 | using Microsoft.AspNetCore.Components; 4 | using Microsoft.AspNetCore.Components.Web; 5 | using Syncfusion.Blazor; 6 | 7 | var builder = WebApplication.CreateBuilder(args); 8 | 9 | // Add services to the container. 10 | builder.Services.AddRazorPages(); 11 | builder.Services.AddServerSideBlazor(); 12 | builder.Services.AddSingleton(); 13 | builder.Services.AddControllers(); 14 | 15 | builder.Services.AddSyncfusionBlazor(options => { options.IgnoreScriptIsolation = true; }); 16 | //Register the Syncfusion locale service to localize Syncfusion Blazor components. 17 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 18 | 19 | var app = builder.Build(); 20 | app.UseRequestLocalization("de-DE"); 21 | // Configure the HTTP request pipeline. 22 | if (!app.Environment.IsDevelopment()) 23 | { 24 | app.UseExceptionHandler("/Error"); 25 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 26 | app.UseHsts(); 27 | } 28 | 29 | app.UseHttpsRedirection(); 30 | 31 | app.UseStaticFiles(); 32 | 33 | app.UseRouting(); 34 | 35 | app.MapBlazorHub(); 36 | app.MapFallbackToPage("/_Host"); 37 | 38 | app.Run(); 39 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:43158", 7 | "sslPort": 44364 8 | } 9 | }, 10 | "profiles": { 11 | "LocalizationServerApp": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:7195;http://localhost:5195", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | LocalizationServerApp 4 | 5 |
6 | 9 | 10 |
11 |
12 | About 13 |
14 | 15 |
16 | @Body 17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationServerApp.Shared 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | // To get the locale key from mapped resources file 8 | public string GetText(string key) 9 | { 10 | return this.ResourceManager.GetString(key); 11 | } 12 | 13 | // To access the resource file and get the exact value for locale key 14 | public System.Resources.ResourceManager ResourceManager 15 | { 16 | get 17 | { 18 | // Replace the ApplicationNamespace with your application name. 19 | return LocalizationServerApp.Resources.SfResources.ResourceManager; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using LocalizationServerApp 10 | @using LocalizationServerApp.Shared 11 | @using Syncfusion.Blazor 12 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor Server App/Localization-with-static-culture/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/LocalizationSample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizationSample", "LocalizationSample.csproj", "{95BF8AB9-BD43-4A48-AED0-36D153CFF6BD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {95BF8AB9-BD43-4A48-AED0-36D153CFF6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {95BF8AB9-BD43-4A48-AED0-36D153CFF6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {95BF8AB9-BD43-4A48-AED0-36D153CFF6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {95BF8AB9-BD43-4A48-AED0-36D153CFF6BD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C2D7E8CE-C409-4D8A-AB78-004333F96AAF} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:58106", 7 | "sslPort": 44387 8 | } 9 | }, 10 | "profiles": { 11 | "LocalizationSample": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 16 | "applicationUrl": "https://localhost:7265;http://localhost:5265", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Shared/CultureSwitcher.razor: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @inject IJSRuntime JSRuntime 3 | @inject NavigationManager NavigationManager 4 | 5 | 11 | 12 | @code { 13 | private CultureInfo[] supportedCultures = new[] 14 | { 15 | new CultureInfo("en-US"), 16 | new CultureInfo("de-DE"), 17 | new CultureInfo("fr-FR"), 18 | new CultureInfo("ar-AE"), 19 | new CultureInfo("zh-HK") 20 | }; 21 | 22 | private CultureInfo Culture 23 | { 24 | get => CultureInfo.CurrentCulture; 25 | set 26 | { 27 | if (CultureInfo.CurrentCulture != value) 28 | { 29 | var js = (IJSInProcessRuntime)JSRuntime; 30 | js.InvokeVoid("cultureInfo.set", value.Name); 31 | 32 | NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | 11 | About 12 |
13 | 14 |
15 | @Body 16 |
17 |
18 |
19 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationSample.Shared 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | // To get the locale key from mapped resources file 8 | public string GetText(string key) 9 | { 10 | return this.ResourceManager.GetString(key); 11 | } 12 | 13 | // To access the resource file and get the exact value for locale key 14 | 15 | public System.Resources.ResourceManager ResourceManager 16 | { 17 | get 18 | { 19 | // Replace the ApplicationNamespace with your application name. 20 | return LocalizationSample.Resources.SfResources.ResourceManager; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 8 | @using Microsoft.JSInterop 9 | @using LocalizationSample 10 | @using LocalizationSample.Shared 11 | @using Syncfusion.Blazor 12 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/icon-192.png -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | LocalizationSample 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
Loading...
18 | 19 |
20 | An unhandled error has occurred. 21 | Reload 22 | 🗙 23 |
24 | 25 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-dynamic-culture/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2018-05-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2018-05-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2018-05-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2018-05-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 | 9 |

Sorry, there's nothing at this address.

10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 |

Counter

6 | 7 |

Current count: @currentCount

8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @using LocalizationWASMApp.Shared 3 | @inject HttpClient Http 4 | 5 | Weather forecast 6 | 7 |

Weather forecast

8 | 9 |

This component demonstrates fetching data from the server.

10 | 11 | @if (forecasts == null) 12 | { 13 |

Loading...

14 | } 15 | else 16 | { 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | @foreach (var forecast in forecasts) 28 | { 29 | 30 | 31 | 32 | 33 | 34 | 35 | } 36 | 37 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
38 | } 39 | 40 | @code { 41 | private WeatherForecast[]? forecasts; 42 | 43 | protected override async Task OnInitializedAsync() 44 | { 45 | forecasts = await Http.GetFromJsonAsync("WeatherForecast"); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Program.cs: -------------------------------------------------------------------------------- 1 | using LocalizationWASMApp.Client; 2 | using LocalizationWASMApp.Client.Shared; 3 | using Microsoft.AspNetCore.Components.Web; 4 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 5 | using Syncfusion.Blazor; 6 | using System.Globalization; 7 | 8 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 9 | builder.RootComponents.Add("#app"); 10 | builder.RootComponents.Add("head::after"); 11 | 12 | builder.Services.AddSyncfusionBlazor(options => { options.IgnoreScriptIsolation = true; }); 13 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 14 | //Register the Syncfusion locale service to localize Syncfusion Blazor components. 15 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 16 | 17 | await builder.Build().RunAsync(); 18 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:3226", 7 | "sslPort": 44303 8 | } 9 | }, 10 | "profiles": { 11 | "LocalizationWASMApp": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 16 | "applicationUrl": "https://localhost:7010;http://localhost:5010", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | 
2 | 3 | @Title 4 | 5 | 6 | Please take our 7 | brief survey 8 | 9 | and tell us what you think. 10 |
11 | 12 | @code { 13 | // Demonstrates how a parent component can supply parameters 14 | [Parameter] 15 | public string? Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/Shared/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | namespace LocalizationWASMApp.Client.Shared 4 | { 5 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 6 | { 7 | // To get the locale key from mapped resources file 8 | public string GetText(string key) 9 | { 10 | return this.ResourceManager.GetString(key); 11 | } 12 | 13 | // To access the resource file and get the exact value for locale key 14 | public System.Resources.ResourceManager ResourceManager 15 | { 16 | get 17 | { 18 | // Replace the ApplicationNamespace with your application name. 19 | return LocalizationWASMApp.Client.Resources.SfResources.ResourceManager; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 8 | @using Microsoft.JSInterop 9 | @using LocalizationWASMApp.Client 10 | @using LocalizationWASMApp.Client.Shared 11 | @using Syncfusion.Blazor 12 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/favicon.ico -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/icon-192.png -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Client/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | LocalizationWASMApp 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
Loading...
18 | 19 |
20 | An unhandled error has occurred. 21 | Reload 22 | 🗙 23 |
24 | 25 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using LocalizationWASMApp.Shared; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace LocalizationWASMApp.Server.Controllers 5 | { 6 | [ApiController] 7 | [Route("[controller]")] 8 | public class WeatherForecastController : ControllerBase 9 | { 10 | private static readonly string[] Summaries = new[] 11 | { 12 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 13 | }; 14 | 15 | private readonly ILogger _logger; 16 | 17 | public WeatherForecastController(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | [HttpGet] 23 | public IEnumerable Get() 24 | { 25 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast 26 | { 27 | Date = DateTime.Now.AddDays(index), 28 | TemperatureC = Random.Shared.Next(-20, 55), 29 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] 30 | }) 31 | .ToArray(); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/LocalizationWASMApp.Server.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using System.Diagnostics; 4 | 5 | namespace LocalizationWASMApp.Server.Pages 6 | { 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | [IgnoreAntiforgeryToken] 9 | public class ErrorModel : PageModel 10 | { 11 | public string? RequestId { get; set; } 12 | 13 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 | 15 | private readonly ILogger _logger; 16 | 17 | public ErrorModel(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | public void OnGet() 23 | { 24 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.ResponseCompression; 2 | 3 | var builder = WebApplication.CreateBuilder(args); 4 | 5 | // Add services to the container. 6 | 7 | builder.Services.AddControllersWithViews(); 8 | builder.Services.AddRazorPages(); 9 | 10 | var app = builder.Build(); 11 | 12 | // Configure the HTTP request pipeline. 13 | if (app.Environment.IsDevelopment()) 14 | { 15 | app.UseWebAssemblyDebugging(); 16 | } 17 | else 18 | { 19 | app.UseExceptionHandler("/Error"); 20 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 21 | app.UseHsts(); 22 | } 23 | 24 | app.UseHttpsRedirection(); 25 | 26 | app.UseBlazorFrameworkFiles(); 27 | app.UseStaticFiles(); 28 | 29 | app.UseRouting(); 30 | 31 | 32 | app.MapRazorPages(); 33 | app.MapControllers(); 34 | app.MapFallbackToFile("index.html"); 35 | 36 | app.Run(); 37 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:3226", 7 | "sslPort": 44303 8 | } 9 | }, 10 | "profiles": { 11 | "LocalizationWASMApp.Server": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 16 | "applicationUrl": "https://localhost:7010;http://localhost:5010", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Server/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Shared/LocalizationWASMApp.Shared.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.NET6 Blazor WASM App/Localization-with-static-culture/Shared/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationWASMApp.Shared 2 | { 3 | public class WeatherForecast 4 | { 5 | public DateTime Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public string? Summary { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | } 13 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | #512bdf 10 | White 11 | 12 | 16 | 17 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace LocalizationMauiBlazor 4 | { 5 | public partial class App : Application 6 | { 7 | public App() 8 | { 9 | InitializeComponent(); 10 | var language = Preferences.Get("language", "en-US"); 11 | var culture = new CultureInfo(language); 12 | CultureInfo.DefaultThreadCurrentCulture = culture; 13 | CultureInfo.DefaultThreadCurrentUICulture = culture; 14 | MainPage = new MainPage(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/CultureSwitcher.razor: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @inject NavigationManager NavigationManager 3 | 4 | 10 | 11 | @code { 12 | private CultureInfo[] supportedCultures = new[] 13 | { 14 | new CultureInfo("en-US"), 15 | new CultureInfo("de-DE"), 16 | new CultureInfo("fr-FR"), 17 | new CultureInfo("ar-AE"), 18 | new CultureInfo("zh-HK") 19 | }; 20 | 21 | private CultureInfo Culture 22 | { 23 | get => CultureInfo.CurrentCulture; 24 | set 25 | { 26 | if (CultureInfo.CurrentCulture != value) 27 | { 28 | CultureInfo.DefaultThreadCurrentCulture = value; 29 | CultureInfo.DefaultThreadCurrentUICulture = value; 30 | Preferences.Set("language", value.Name); 31 | NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | 15 | @Body 16 |
17 |
18 |
19 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 28 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 4 | { 5 | public string GetText(string key) 6 | { 7 | return this.ResourceManager.GetString(key); 8 | } 9 | 10 | public System.Resources.ResourceManager ResourceManager 11 | { 12 | get 13 | { 14 | // Replace the ApplicationNamespace with your application name. 15 | return LocalizationMauiBlazor.LocalizationResources.SfResources.ResourceManager; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/LocalizationMauiBlazor.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | False 5 | net8.0-windows10.0.19041.0 6 | Windows Machine 7 | Emulator 8 | pixel_5_-_api_33 9 | 10 | 11 | ProjectDebugger 12 | 13 | 14 | 15 | Designer 16 | 17 | 18 | Designer 19 | 20 | 21 | Designer 22 | 23 | 24 | Designer 25 | 26 | 27 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationMauiBlazor 2 | { 3 | public partial class MainPage : ContentPage 4 | { 5 | public MainPage() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Microsoft.JSInterop; 3 | using Syncfusion.Blazor; 4 | using System.Globalization; 5 | 6 | namespace LocalizationMauiBlazor 7 | { 8 | public static class MauiProgram 9 | { 10 | public static MauiApp CreateMauiApp() 11 | { 12 | var builder = MauiApp.CreateBuilder(); 13 | builder 14 | .UseMauiApp() 15 | .ConfigureFonts(fonts => 16 | { 17 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); 18 | }); 19 | 20 | builder.Services.AddMauiBlazorWebView(); 21 | 22 | #if DEBUG 23 | builder.Services.AddBlazorWebViewDeveloperTools(); 24 | builder.Logging.AddDebug(); 25 | #endif 26 | builder.Services.AddSyncfusionBlazor(); 27 | 28 | // Register the locale service to localize the SyncfusionBlazor components. 29 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 30 | 31 | return builder.Build(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.OS; 4 | 5 | namespace LocalizationMauiBlazor 6 | { 7 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] 8 | public class MainActivity : MauiAppCompatActivity 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Runtime; 3 | 4 | namespace LocalizationMauiBlazor 5 | { 6 | [Application] 7 | public class MainApplication : MauiApplication 8 | { 9 | public MainApplication(IntPtr handle, JniHandleOwnership ownership) 10 | : base(handle, ownership) 11 | { 12 | } 13 | 14 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #512BD4 4 | #2B0B98 5 | #2B0B98 6 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/MacCatalyst/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace LocalizationMauiBlazor 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/MacCatalyst/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | com.apple.security.app-sandbox 8 | 9 | 10 | com.apple.security.network.client 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/MacCatalyst/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace LocalizationMauiBlazor 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Tizen/Main.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Hosting; 3 | using System; 4 | 5 | namespace LocalizationMauiBlazor 6 | { 7 | internal class Program : MauiApplication 8 | { 9 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 10 | 11 | static void Main(string[] args) 12 | { 13 | var app = new Program(); 14 | app.Run(args); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Tizen/tizen-manifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | maui-appicon-placeholder 7 | 8 | 9 | 10 | 11 | http://tizen.org/privilege/internet 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Windows/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Windows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | 3 | // To learn more about WinUI, the WinUI project structure, 4 | // and more about our project templates, see: http://aka.ms/winui-project-info. 5 | 6 | namespace LocalizationMauiBlazor.WinUI 7 | { 8 | /// 9 | /// Provides application-specific behavior to supplement the default Application class. 10 | /// 11 | public partial class App : MauiWinUIApplication 12 | { 13 | /// 14 | /// Initializes the singleton application object. This is the first line of authored code 15 | /// executed, and as such is the logical equivalent of main() or WinMain(). 16 | /// 17 | public App() 18 | { 19 | this.InitializeComponent(); 20 | } 21 | 22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/Windows/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace LocalizationMauiBlazor 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSRequiresIPhoneOS 6 | 7 | UIDeviceFamily 8 | 9 | 1 10 | 2 11 | 12 | UIRequiredDeviceCapabilities 13 | 14 | arm64 15 | 16 | UISupportedInterfaceOrientations 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationLandscapeLeft 20 | UIInterfaceOrientationLandscapeRight 21 | 22 | UISupportedInterfaceOrientations~ipad 23 | 24 | UIInterfaceOrientationPortrait 25 | UIInterfaceOrientationPortraitUpsideDown 26 | UIInterfaceOrientationLandscapeLeft 27 | UIInterfaceOrientationLandscapeRight 28 | 29 | XSAppIconAssets 30 | Assets.xcassets/appicon.appiconset 31 | 32 | 33 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Platforms/iOS/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace LocalizationMauiBlazor 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Windows Machine": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Resources/AppIcon/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Resources/Fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Resources/Fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Resources/Raw/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories). Deployment of the asset to your application 3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. 4 | 5 | 6 | 7 | These files will be deployed with you package and will be accessible using Essentials: 8 | 9 | async Task LoadMauiAsset() 10 | { 11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); 12 | using var reader = new StreamReader(stream); 13 | 14 | var contents = reader.ReadToEnd(); 15 | } 16 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Routes.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.JSInterop 8 | @using LocalizationMauiBlazor 9 | @using LocalizationMauiBlazor.Components 10 | @using Syncfusion.Blazor -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET8 MAUI Blazor App/Localization-with-dynamic-culture/wwwroot/favicon.png -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-dynamic-culture/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | LocalizationMauiBlazor 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |
Loading...
21 | 22 |
23 | An unhandled error has occurred. 24 | Reload 25 | 🗙 26 |
27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | #512bdf 10 | White 11 | 12 | 16 | 17 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationMauiBlazor 2 | { 3 | public partial class App : Application 4 | { 5 | public App() 6 | { 7 | InitializeComponent(); 8 | 9 | MainPage = new MainPage(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Components/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Components/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 28 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Components/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Components/SyncfusionLocalizer.cs: -------------------------------------------------------------------------------- 1 | using Syncfusion.Blazor; 2 | 3 | public class SyncfusionLocalizer : ISyncfusionStringLocalizer 4 | { 5 | public string GetText(string key) 6 | { 7 | return this.ResourceManager.GetString(key); 8 | } 9 | 10 | public System.Resources.ResourceManager ResourceManager 11 | { 12 | get 13 | { 14 | // Replace the ApplicationNamespace with your application name. 15 | return LocalizationMauiBlazor.LocalizationResources.SfResources.ResourceManager; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/LocalizationMauiBlazor.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | False 5 | net8.0-windows10.0.19041.0 6 | Windows Machine 7 | 8 | 9 | 10 | Designer 11 | 12 | 13 | Designer 14 | 15 | 16 | Designer 17 | 18 | 19 | Designer 20 | 21 | 22 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace LocalizationMauiBlazor 2 | { 3 | public partial class MainPage : ContentPage 4 | { 5 | public MainPage() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Syncfusion.Blazor; 3 | using System.Globalization; 4 | 5 | namespace LocalizationMauiBlazor 6 | { 7 | public static class MauiProgram 8 | { 9 | public static MauiApp CreateMauiApp() 10 | { 11 | var builder = MauiApp.CreateBuilder(); 12 | builder 13 | .UseMauiApp() 14 | .ConfigureFonts(fonts => 15 | { 16 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); 17 | }); 18 | 19 | builder.Services.AddMauiBlazorWebView(); 20 | 21 | #if DEBUG 22 | builder.Services.AddBlazorWebViewDeveloperTools(); 23 | builder.Logging.AddDebug(); 24 | #endif 25 | builder.Services.AddSyncfusionBlazor(); 26 | // Register the locale service to localize the SyncfusionBlazor components. 27 | builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); 28 | 29 | CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("de-DE"); 30 | CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("de-DE"); 31 | 32 | return builder.Build(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.OS; 4 | 5 | namespace LocalizationMauiBlazor 6 | { 7 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] 8 | public class MainActivity : MauiAppCompatActivity 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Runtime; 3 | 4 | namespace LocalizationMauiBlazor 5 | { 6 | [Application] 7 | public class MainApplication : MauiApplication 8 | { 9 | public MainApplication(IntPtr handle, JniHandleOwnership ownership) 10 | : base(handle, ownership) 11 | { 12 | } 13 | 14 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #512BD4 4 | #2B0B98 5 | #2B0B98 6 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/MacCatalyst/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace LocalizationMauiBlazor 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/MacCatalyst/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | com.apple.security.app-sandbox 8 | 9 | 10 | com.apple.security.network.client 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/MacCatalyst/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace LocalizationMauiBlazor 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Tizen/Main.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Hosting; 3 | using System; 4 | 5 | namespace LocalizationMauiBlazor 6 | { 7 | internal class Program : MauiApplication 8 | { 9 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 10 | 11 | static void Main(string[] args) 12 | { 13 | var app = new Program(); 14 | app.Run(args); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Tizen/tizen-manifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | maui-appicon-placeholder 7 | 8 | 9 | 10 | 11 | http://tizen.org/privilege/internet 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Windows/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Windows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | 3 | // To learn more about WinUI, the WinUI project structure, 4 | // and more about our project templates, see: http://aka.ms/winui-project-info. 5 | 6 | namespace LocalizationMauiBlazor.WinUI 7 | { 8 | /// 9 | /// Provides application-specific behavior to supplement the default Application class. 10 | /// 11 | public partial class App : MauiWinUIApplication 12 | { 13 | /// 14 | /// Initializes the singleton application object. This is the first line of authored code 15 | /// executed, and as such is the logical equivalent of main() or WinMain(). 16 | /// 17 | public App() 18 | { 19 | this.InitializeComponent(); 20 | } 21 | 22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/Windows/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace LocalizationMauiBlazor 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSRequiresIPhoneOS 6 | 7 | UIDeviceFamily 8 | 9 | 1 10 | 2 11 | 12 | UIRequiredDeviceCapabilities 13 | 14 | arm64 15 | 16 | UISupportedInterfaceOrientations 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationLandscapeLeft 20 | UIInterfaceOrientationLandscapeRight 21 | 22 | UISupportedInterfaceOrientations~ipad 23 | 24 | UIInterfaceOrientationPortrait 25 | UIInterfaceOrientationPortraitUpsideDown 26 | UIInterfaceOrientationLandscapeLeft 27 | UIInterfaceOrientationLandscapeRight 28 | 29 | XSAppIconAssets 30 | Assets.xcassets/appicon.appiconset 31 | 32 | 33 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Platforms/iOS/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace LocalizationMauiBlazor 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Windows Machine": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Resources/AppIcon/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Resources/Fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET8 MAUI Blazor App/Localization-with-static-culture/Resources/Fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Resources/Raw/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories). Deployment of the asset to your application 3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. 4 | 5 | 6 | 7 | These files will be deployed with you package and will be accessible using Essentials: 8 | 9 | async Task LoadMauiAsset() 10 | { 11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); 12 | using var reader = new StreamReader(stream); 13 | 14 | var contents = reader.ReadToEnd(); 15 | } 16 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/Routes.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.JSInterop 8 | @using LocalizationMauiBlazor 9 | @using LocalizationMauiBlazor.Components 10 | @using Syncfusion.Blazor 11 | @using Syncfusion.Blazor.Grids -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/.NET8 MAUI Blazor App/Localization-with-static-culture/wwwroot/favicon.png -------------------------------------------------------------------------------- /.NET8 MAUI Blazor App/Localization-with-static-culture/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | LocalizationMauiBlazor 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |
Loading...
21 | 22 |
23 | An unhandled error has occurred. 24 | Reload 25 | 🗙 26 |
27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blazor Localization Examples 2 | 3 | Localization examples showing localization of Syncfusion Blazor UI components in Blazor Server and Blazor WebAssembly application. 4 | 5 | ## Prerequisites 6 | 7 | * Visual Studio 2022 8 | 9 | ## How to run the project 10 | 11 | * Checkout this project to a location in your disk. 12 | * Open the specified application from the following folder either `.NET5 Blazor Server App` or `.NET5 Blazor WASM App` or `.NET6 Blazor Server App` or `.NET6 Blazor WASM App`. 13 | * Restore the NuGet packages by rebuilding the solution. 14 | * Run the project. 15 | 16 | > Always use latest resource (resx) files from [blazor locale](https://github.com/syncfusion/blazor-locale) repo. 17 | 18 | ## See also 19 | 20 | * [Blazor Localization documentation](https://blazor.syncfusion.com/documentation/common/localization/) 21 | -------------------------------------------------------------------------------- /dynamic-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/dynamic-output.png -------------------------------------------------------------------------------- /static-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SyncfusionExamples/blazor-localization/3cb6e78307642d776a1d322b2aeab82ddd75b976/static-output.png --------------------------------------------------------------------------------