Console error when deploying a project with Scheduler to Azure

When deploying a project with Scheduler to Azure (using 18.1.0.42) 

we get this error on page loading, this is an absolute showstopper for us using Syncfusion

blazor.server.js:15 [2020-04-07T16:41:41.798Z] Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: The given key 'en-US' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Syncfusion.Blazor.Locale.GetLocale(String culture)
   at Syncfusion.Blazor.Schedule.Internal.VerticalView`1..ctor()

5 Replies

AK Alagumeena Kalaiselvan Syncfusion Team April 8, 2020 02:00 PM UTC

Hi  Alex, 
 
Greetings from Syncfusion support! 
 
We have validated your reported issue and We would like to inform you that, we have modified the localization functionality for Blazor server side sample (based on .NET core approach) in our latest version 18.1.0.42. Please refer the below release notes for more details,  
  
Also, we have created a sample by applying localization with de culture for Scheduler and you can get this sample using the below link. 
  
Please refer the below configuration for more information.  
  
[index.razor]  
<SfSchedule TValue="AppointmentData" Locale="de-DE" Height="650px" SelectedDate="@(new DateTime(2020, 2, 14))"> 
    <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings> 
</SfSchedule> 
 
@code{ 
    List<AppointmentData> DataSource = new List<AppointmentData> 
{ 
        new AppointmentData { Id = 1, Subject = "Paris", StartTime = new DateTime(2020, 2, 13, 10, 0, 0) , EndTime = new DateTime(2020, 2, 13, 12, 0, 0) }, 
        new AppointmentData { Id = 2, Subject = "Germany", StartTime = new DateTime(2020, 2, 15, 10, 0, 0) , EndTime = new DateTime(2020, 2, 15, 12, 0, 0) } 
    }; 
    public class AppointmentData 
    { 
        public int Id { get; set; } 
        public string Subject { get; set; } 
        public DateTime StartTime { get; set; } 
        public DateTime EndTime { get; set; } 
    } 
} 
   
[startup.cs]  
namespace blazordatagrid 
{  
    public class Startup  
    {  
        public Startup(IConfiguration configuration)  
        {  
            Configuration = configuration;  
        }  
  
        public IConfiguration Configuration { get; }  
  
        // This method gets called by the runtime. Use this method to add services to the container.  
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940  
        public void ConfigureServices(IServiceCollection services)  
        {  
            services.AddSyncfusionBlazor();  
            services.AddLocalization(options => options.ResourcesPath = "Resources");  
            services.Configure<RequestLocalizationOptions>(options =>  
            {  
                //    // define the list of cultures your app will support  
                var supportedCultures = new List<CultureInfo>()  
            {  
                new CultureInfo("en-US"),  
                new CultureInfo("de-DE")  
            };  
  
                // set the default culture  
                options.DefaultRequestCulture = new RequestCulture("de-DE");  
  
                options.SupportedCultures = supportedCultures;  
                options.SupportedUICultures = supportedCultures;  
                options.RequestCultureProviders = new List<IRequestCultureProvider>() {   
                 new QueryStringRequestCultureProvider()  
                };  
            });  
            services.AddRazorPages();  
            services.AddServerSideBlazor();  
            services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SampleLocalizer));  
            services.AddSingleton<WeatherForecastService>();  
        }  
  
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.  
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)  
        {  
            //#region Localization  
  
            app.UseRequestLocalization();  
  
            . . . .  
   }  
}  
  
  
Note : We have generated the resource file based on the culture(de) and use that resource file in the above attached application.  
  
public class SampleLocalizer : ISyncfusionStringLocalizer  
    {  
  
        public string Get(string key)  
        {  
            return this.Manager.GetString(key);  
        }  
  
        public System.Resources.ResourceManager Manager  
        {  
            get  
            {  
                return  blazordatagrid.Resources.SyncfusionBlazorLocale.ResourceManager;  
            }  
        }  
    }  
  
Note: Add the resx files to Resources folder. Mark the resx files as Embedded resource  
  
Please refer the below Microsoft reference links for more details,  
Reference Link:   
  
Currently we don’t have documentation for this. We are working on documenting this topic and we will include the changes and refresh the documentation which is in live.   
  
Kindly try out with shared sample and get back to us, If the issue may still persist. 
 
Regards 
Alagumeena.K 



AL Alex April 9, 2020 11:37 AM UTC

Thanks!


AK Alagumeena Kalaiselvan Syncfusion Team April 10, 2020 03:33 AM UTC

Hi Alex, 

You are most welcome. 

Please keep in touch with us, If you need further assistance. 

Regards 
Alagumeena.K 



UH Uwe Hein April 11, 2020 10:15 AM UTC

Hi Alagumeena.K,

  thank you for your instructive example, but there are some questions left as the documentation still is contradictory:

1. Will localization remain unchanged in client side blazor ?

2. I am using a datagrid and a scheduler in an serverside blazor app and need to use the DE-de locale. Must I create a resx file for each control or can I add the missing datagrid entries to the scheduler resx you provided with the sample in this thread to have only one resx file for each language?

3. Will there be a link to download the resx files for all controls and languages ?

    TIA

      regards

         Uwe


AK Alagumeena Kalaiselvan Syncfusion Team April 13, 2020 12:59 PM UTC

Hi Uwe, 

Thanks for your update. 

Query #1: Will localization remain unchanged in client side blazor? 

Yes, the localization remain unchanged in client side blazor. 

Query #2:  Must I create a resx file for each control? 

No, you can use a single resx file for all components and which have all component entries. 

Query #3: Will there be a link to download the resx files for all controls and languages? 
 
We have planned to include the resource file in GitHub repository and it will be available on or before April 24, 2020. Until then, We request you to use the resource files from the below link. 
 
 
Please let us know, If the solution helps. 
 
Regards 
Alagumeena.K  


Loader.
Up arrow icon