Articles in this section
Category / Section

Why is Localization Problematic When Defined as `Public`?

Published:
Updated:

When IStringLocalizer<Language> is declared as a public property, it may lead to conflicts in dependency injection (DI). DI expects a controlled, immutable reference, which is best achieved by defining it as a private readonly field in the controller.

private readonly Microsoft.Extensions.Localization.IStringLocalizer<Language> _languages;
How Bold Reports Supports Localization:

Bold Reports allows localization of static text, including tooltips, parameter blocks, and dialog text, based on a specified culture. The localization process involves:

  1. Using the appropriate culture script files.
  2. Setting the locale property in the Report Viewer configuration.
$("#viewer").boldReportViewer({
    reportServiceUrl: "https://on-premise-demo.boldreports.com/ReportService/api/Viewer",
    serviceAuthorizationToken: token.token_type + " " + token.access_token,
    reportPath: '/Sample Reports/Sales Order Detail',
    locale: "fr-FR" // Example: French locale
});
Potential Issues with Incorrect Localization Implementation:
  • DI Conflicts: Public properties may create multiple instances, leading to unexpected behavior.
  • Localization Failures: Incorrect injection can lead to the improper application of translations.
  • Performance Issues: Improper DI management can result in unnecessary memory use.
Additional Resources
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied