mccj/Hangfire.Dashboard.Management

Setting culture does not change language on azure app service for linux

Opened this issue · 1 comments

The SetCulture method doesn't seem to have an affect on the dashboard language when running on app service for linux in azure. Example setup:

                services.AddHangfire(configuration => configuration
                    .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                    .UseSimpleAssemblyNameTypeSerializer()
                    .UseRecommendedSerializerSettings()
                    .UseSqlServerStorage(hangfireOptions.ConnectionString, new SqlServerStorageOptions
                    {
                        CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
                        SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
                        QueuePollInterval = TimeSpan.FromSeconds(30),
                        UseRecommendedIsolationLevel = true,
                        DisableGlobalLocks = true
                    })
                    .UseManagementPages(config => config
                        .AddJobs(typeof(JobScheduler).Assembly)
                        .SetCulture(new CultureInfo("en-US")) // doesn't seem to do anything
                    ));

The UI is still displayed in Chinese even with .SetCulture. As a workaround, I had to add these to my apps application settings to get it to display in English:

  {
    "name": "LANG",
    "value": "en_US.UTF-8",
    "slotSetting": true
  },
  {
    "name": "LANGUAGE",
    "value": "en_US.UTF-8",
    "slotSetting": true
  },
  {
    "name": "LC_ALL",
    "value": "en_US.UTF-8",
    "slotSetting": true
  }

Try to use it. It works for me, but it will have a few problem.
For example: The status column name is Chinese language.

.SetCulture(new System.Globalization.CultureInfo("en-US"))