Localization Admin
PowerPortalsPro ships a LocalizationAdmin component — a turnkey, SystemAdmin-gated panel for operating the string-localization pipeline at runtime. Drop <LocalizationAdmin /> into a role-gated page and an admin can see how the localization cache is configured and built, rebuild it without restarting the host, machine-translate localization files, and download a merged per-culture snapshot. The framework component does the heavy lifting; your portal supplies the page, the role gate, and the nav link — the same split the Site Admin page uses.
What the panel shows
LocalizationAdmin renders several sections, each backed by the framework's localization services:
- Configuration — A read-only summary of how the warmup is wired — whether every available table is localized or only a configured set, the tables to localize, the web-resource path pattern, the registered localization directories and files, and the default culture. These mirror the
LocalizationOptionsyour host registers. - Translate a file — An embedded
LocalizationTranslatorthat machine-translates a localization file into another culture. It self-gates on availability — rendering nothing when no translation provider is configured, or an install prompt when the managed solution is missing. The Translation documentation page covers it in full. - Download merged bundle — One button per culture that has any keys in the cache. Each downloads the merged localization JSON for that culture — the union of every source (Dataverse metadata, web resources, and folder files) resolved into a single file.
- Sources — A grid of the per-source load records from the most recent warmup, in load order — including how many keys each source contributed and how many of those overrode an earlier value. The quickest way to see why a string resolved the way it did.
- Reload — Rebuilds the string-localization cache from every configured source without restarting the host. The rebuild is atomic, so readers keep seeing the previous values until the new dictionary is ready.
Wiring it up
Like the Site Admin page, LocalizationAdmin is gated behind the synthetic SystemAdmin role claim stamped by SystemAdminClaimsTransformer — the Site Admin documentation page covers how that claim is configured. Drop the component inside a role-gated page:
@attribute [Route("admin/localization")]
@attribute [Authorize(Roles = "SystemAdmin")]
@using PowerPortalsPro.Web.Blazor.FluentUI.Components
<AuthorizeView Roles="SystemAdmin">
<Authorized>
<LocalizationAdmin />
</Authorized>
</AuthorizeView>
Surface it in the nav
Wrap the nav entry in an <AuthorizeView Roles="SystemAdmin"> so non-admins don't see a link they can't follow:
<AuthorizeView Roles="SystemAdmin">
<Authorized>
<FluentNavGroup Title="Admin" Icon="@(new Size20.WrenchSettings())">
<FluentNavLink Href="admin/localization"
Icon="@(new Size20.LocalLanguage())">
Localization
</FluentNavLink>
</FluentNavGroup>
</Authorized>
</AuthorizeView>
Controlling what gets localized
The Configuration panel reflects the LocalizationOptions your host registers. LocalizeAllAvailableTables switches between localizing every table and only an explicit set added via AddTableToLocalize; the directory, file, and web-resource settings tell the warmup where to find folder-based and web-resource localization sources. The full set of knobs is in the API reference below.
Related: the Translation page
The translate-a-file panel embedded here is the same
LocalizationTranslatordocumented on the Translation page, which walks through configuring a translation provider (e.g. Azure AI Translator) and installing the managed solution that backs it.
API reference
LocalizationOptions drives what the Configuration panel surfaces and what the warmup pulls from. Its members are summarized below.
LocalizationOptions Class
Properties
Name | Type | Default | Description |
|---|---|---|---|
DefaultCulture | CultureInfo | The default culture used when no specific culture is requested. | |
LocalizationDirectories | IReadOnlyList<string> | The list of directory paths to scan for localization files. | |
LocalizationFiles | IReadOnlyList<string> | The list of individual file paths to load localization strings from. | |
LocalizeAllAvailableTables | bool | True | When LocalizationOptions.TablesToLocalize is ignored. Set to AddTableToLocalize(System.String) / IEnumerable{System.String}). |
TablesToLocalize | IReadOnlyList<string> | The Dataverse table names whose metadata (labels, choices, views) should be exported as localized strings. Ignored when LocalizationOptions.LocalizeAllAvailableTables is | |
UrlCultureStrategy | UrlCultureStrategy | PathPrefix | Controls whether (and how) the active culture is reflected in the request URL. Defaults to UrlCultureStrategy.PathPrefix (default culture bare, other cultures under a Options.UrlCultureStrategy for the available modes. Only has an effect on multi-culture sites. |
DefaultCultureLocalizationDirectoriesLocalizationFilesLocalizeAllAvailableTablesLocalizationOptions.TablesToLocalize is ignored. Set to AddTableToLocalize(System.String) / IEnumerable{System.String}). TablesToLocalizeLocalizationOptions.LocalizeAllAvailableTables is UrlCultureStrategyUrlCultureStrategy.PathPrefix (default culture bare, other cultures under a Options.UrlCultureStrategy for the available modes. Only has an effect on multi-culture sites.Methods
Name | Parameters | Type | Description |
|---|---|---|---|
AddLocalizationDirectory | string relativeDirectoryPath | void | Adds a directory path to scan for localization files. |
AddLocalizationFile | string relativeFilePath | void | Adds a single localization file path to the list. |
AddTablesToLocalize | IEnumerable<string> tables | void | Adds a collection of Dataverse table names to localize. |
AddTableToLocalize | string tableName | void | Adds a single Dataverse table name to localize. |
AddLocalizationDirectoryAddLocalizationFileAddTablesToLocalizeAddTableToLocalize