components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.description
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.files-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.files-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-files-json-comment
{
"app": {
"navigation": {
"home": "Home",
"contacts": "Contacts"
}
}
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.react-bootstrap-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.react-bootstrap-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-react-bootstrap-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-react-bootstrap-comment-line2
import { LocaleProvider, PowerPortalsProProvider } from '@powerportalspro/react';
export function App() {
return (
<LocaleProvider>
<PowerPortalsProProvider>
<Routes />
</PowerPortalsProProvider>
</LocaleProvider>
);
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.blazor-bootstrap-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.blazor-bootstrap-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-blazor-bootstrap-comment
builder.Services.AddPowerPortalsPro(options =>
{
options.AddLocalizationDirectory("localization");
options.AddLocalizationDirectory("_content/MyApp.Client/localization");
});
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-files-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-files-description
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-files-naming
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-files-example-intro
localization/
app.en.json
app.fr.json
emails.signup-confirmation.body.en.html
emails.signup-confirmation.body.fr.html
emails.password-reset.body.en.html
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-files-example-mapping
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-html-retrieve-comment
var emailBody = _localizer["emails.signup-confirmation.body"];
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-files-usage
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.table-labels-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.table-labels-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-tables-comment
{
"tables": {
"account": {
"label": "Account",
"collectionLabel": "Accounts",
"columns": {
"name": {
"label": "Account Name",
"description": "The name of the account."
}
},
"views": {
"00000000-0000-0000-0000-000000000001": {
"label": "Active Accounts"
}
}
}
}
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.note-label
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.table-labels-limit-tip
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.views-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.views-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-views-comment
{
"tables": {
"account": {
"views": {
"00000000-0000-0000-00aa-000010001001": {
"label": "Active Accounts"
},
"00000000-0000-0000-00aa-000010001002": {
"label": "Inactive Accounts"
},
"91732ad4-b4fe-49ff-80cd-72b280eff088": {
"label": "All Contacts & Accounts"
}
}
}
}
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.note-label
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.views-custom-note
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.view-columns-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.view-columns-description
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.view-columns-override
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-view-columns-comment
{
"tables": {
"account": {
"views": {
"00000000-0000-0000-00aa-000010001001": {
"label": "Active Accounts",
"columns": {
"name": {
"label": "Company",
"description": "The company name for this account."
},
"contact.emailaddress1": {
"label": "Contact Email"
}
}
}
}
}
}
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.note-label
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.view-columns-linked
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-description
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-local-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-local-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-choices-local-comment
{
"tables": {
"account": {
"choices": {
"account_accountcategorycode": {
"label": "Category",
"values": {
"1": { "label": "Preferred Customer" },
"2": { "label": "Standard" }
}
}
}
}
}
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-global-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-global-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-choices-global-comment
{
"choices": {
"powerpagelanguages": {
"label": "Preferred Language",
"values": {
"1033": { "label": "English" },
"1036": { "label": "French" },
"1031": { "label": "German" }
}
}
}
}
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.note-label
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.choices-note
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.injection-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.injection-description
- components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.injection-global
- components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.injection-typed
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-react-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-react-comment-line2
import { useT, usePrefixedT } from '@powerportalspro/react';
function MyComponent() {
const t = useT();
const label = t('app.navigation.home');
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-react-comment-line3
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-react-comment-line4
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-react-comment-line5
const componentT = usePrefixedT(
'components.MyApp.Pages.MyComponent',
);
const title = componentT('title'); // components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-trail-comment
return <h1>{title}</h1>;
}// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-razor-global-comment
[Inject]
private IStringLocalizer _localizer { get; set; } = null!;
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-injection-razor-scoped-comment
[Inject]
private IStringLocalizer<MyComponent> _localizer { get; set; } = null!;components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.component-keys-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.component-keys-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-component-keys-json-comment
{
"components": {
"MyApp.Client": {
"Pages": {
"Editors": {
"TextEdit": {
"TextEditDemoPage": {
"title": "TextEdit",
"description": "A single-line text input."
}
}
}
}
}
}
}
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-component-component-react-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-component-component-react-comment-line2
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-component-component-react-comment-line3
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-component-component-react-comment-line4
import { usePrefixedT } from '@powerportalspro/react';
const STRINGS_BASE =
'components.MyApp.Client.Pages.Editors.TextEdit.TextEditDemoPage';
export function TextEditDemoPage() {
const t = usePrefixedT(STRINGS_BASE);
return (
<>
<h1>{t('title')}</h1>
<p dangerouslySetInnerHTML={{ __html: t('description') }} />
</>
);
}<!-- components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-component-component-razor-comment -->
@inject IStringLocalizer<TextEditDemoPage> _localizer
<h1>@_localizer["title"]</h1>
<p>@_localizer["description"].ToMarkupString()</p>components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.prefixed-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.prefixed-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-react-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-react-comment-line2
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-react-comment-line3
import { usePrefixedT } from '@powerportalspro/react';
function Nav() {
const t = usePrefixedT('app.navigation');
const home = t('home'); // components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-react-trail-home
const contacts = t('contacts'); // components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-react-trail-contacts
return /* ... */;
}// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-razor-without-comment
var home = _localizer["app.navigation.home"];
var contacts = _localizer["app.navigation.contacts"];
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-prefixed-razor-with-comment
var navLocalizer = _localizer.GetPrefixedLocalizer("app.navigation");
var home = navLocalizer["home"];
var contacts = navLocalizer["contacts"];components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.html-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-html-react-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-html-react-comment-line2
<p dangerouslySetInnerHTML={{ __html: t('description') }} /><!-- components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-html-razor-comment -->
<p>@_localizer["description"].ToMarkupString()</p>components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.find-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.find-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-find-react-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-find-react-comment-line2
import { useT } from '@powerportalspro/react';
function resolve(t: ReturnType<typeof useT>, ...candidates: string[]): string {
for (const key of candidates) {
const value = t(key);
if (value !== key) return value;
}
return candidates[candidates.length - 1];
}
const t = useT();
const label = resolve(
t,
`tables.${tableName}.columns.${columnName}.label`,
`tables.${tableName}.label`,
);// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-find-razor-comment
var label = _localizer.FindLocalizedString(
$"tables.{tableName}.columns.{columnName}.label",
$"tables.{tableName}.label");components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.find-react-note
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.interpolation-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.interpolation-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-interp-json-comment
{
"app": {
"welcome": "Welcome back, {0}! You have {1} unread messages."
}
}
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-interp-react-comment
const greeting = t('app.welcome', [userName, unreadCount]);// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-interp-razor-comment
var greeting = _localizer["app.welcome", userName, unreadCount];components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.eager-loading-title
components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.eager-loading-description
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-eager-comment-line1
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-eager-comment-line2
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-eager-comment-line3
// components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-eager-comment-line4
import { useLocalization } from '@powerportalspro/react';
function AccountFormPage() {
useLocalization(['tables.account', 'tables.contact']);
return /* components.PowerPortalsPro.Demo.Client.Customizations.Pages.Services.Localization.StringLocalizerDemoPage.snippet-eager-form-comment */;
}
IStringLocalizer Interface
components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.properties
components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.name | components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.type | components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.default | components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.description |
|---|---|---|---|
Item | LocalizedString |
Itemcomponents.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.methods
components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.name | components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.parameters | components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.type | components.PowerPortalsPro.Demo.Client.Customizations.Components.Documentation.ApiDocumentation.description |
|---|---|---|---|
FindLocalizedString | string[] keys | LocalizedString | 提供されたキーに基づいて最初の有効なマッチを返します。 |
GetAllStrings | bool includeParentCultures | IEnumerable<LocalizedString> | |
GetPrefixedLocalizer | string prefix | IPrefixedStringLocalizer | すべてのキールックアップに与えられたプレフィックスの前置きとなる新しい Localization.IPrefixedStringLocalizer を返します。 |
FindLocalizedStringGetAllStringsGetPrefixedLocalizerLocalization.IPrefixedStringLocalizer を返します。