Question 1: How to re-read user data after language setting change using UserAccountFacade in Spartacus
The Observable shown above can be extended.
Then use combineLatest to combine with other Observables.
Issue 2: Encountered error message when using outlet: Type before is not assignable to type OutletPosition
solution:
add outletPosition = OutletPosition;
to the component,
Add code to HTML:
[cxOutletPos]="outletPosition.BEFORE"
Also need to check:
did you add the outlets to the app component html?
For example, add the following code to the Component HTML:
<outlets></outlets>
Problem 2: HTTP 400 and 404
For the product detail page, just enter a non-existing url and the return value is HTTP 400:
https://cloudapp.azure.com:9002/occ/v2/electronics-spa/cms/pages?pageType=CategoryPage&code=5781122&lang=en&curr=USD
wrong information:
{
"errors" : [ {
"message" : "The value provided is not allowed.",
"reason" : "invalid",
"subject" : "code",
"subjectType" : "parameter",
"type" : "ValidationError"
} ]
}
If the content page request does not exist:
https://cloudapp.azure.com:9002/occ/v2/electronics-spa/cms/pages?pageType=ContentPage&pageLabelOrId=%2Ftest&lang=en&curr=USD
Returns the error message:
"errors" : [ {
"message" : "No content page found matching the provided label or id: /test",
"type" : "CMSItemNotFoundError"
} ]
}
Clients can use custom renderKeyResolver
to dynamically decide which page should use which rendering strategy, SSR or CSR.
Storefronts in production mode display non-breaking space characters if a translation is missing for a particular key. To make it easier to catch missing keys, in development mode, Spartacus displays the translation keys, preceded by the name of the block and a colon (for example, [common:form.confirm]
).
If translations are missing, developers can specify alternate languages in order to provide a better user experience. Setting the fallbackLang option ensures that for each missing translation, the equivalent from the fallback language is used.
Here is an example configuration using English as the alternate language:
import { translations, translationChunksConfig } from '@spartacus/assets';
// ...
providers: [
provideConfig({
i18n: {
resources: translations,
chunks: translationChunksConfig,
fallbackLang: 'en',
},
}),
];
Translations consist of language and named blocks, so developers can load translation resources only for the current language and current page. The following is an example of the structure of a translation resource:
interface TranslationResources {
[lang: string]: {
[chunkName: string]: {
[key: string]: any; // value or nested object with keys
};
};
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。