Skip to content

Commit

Permalink
Fix #5760: Locale setup docs (#5762)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 13, 2024
1 parent 3a221fe commit f2d49de
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
35 changes: 35 additions & 0 deletions components/doc/configuration/locale/setuplocaledoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';

export function SetupLocaleDoc(props) {
const code = {
basic: `
//_app.js
import { PrimeReactProvider } from 'primereact/api';
export default function MyApp({ Component }) {
const value = {
locale: 'de',
...
};
return (
<PrimeReactProvider value={value}>
<App />
</PrimeReactProvider>
);
}
`
};

return (
<>
<DocSectionText {...props}>
<p>
To establish the default locale for your entire application, you can utilize the <i>PrimeReactProvider</i>.
</p>
</DocSectionText>
<DocSectionCode code={code} hideToggleCode import hideCodeSandbox hideStackBlitz />
</>
);
}
8 changes: 7 additions & 1 deletion pages/configuration/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DocComponent } from '@/components/doc/common/doccomponent';
import { AppendToDoc } from '@/components/doc/configuration/appendtodoc';
import { StyleContainer } from '@/components/doc/configuration/stylecontainer';
import { CSSTransitionDoc } from '@/components/doc/configuration/csstransitiondoc';
import { FilterMatchModeDoc } from '@/components/doc/configuration/filtermatchmodedoc';
import { HideOverlaysDoc } from '@/components/doc/configuration/hideoverlaysdoc';
Expand All @@ -9,9 +8,11 @@ import { AddLocaleDoc } from '@/components/doc/configuration/locale/addlocaledoc
import { ImportDoc } from '@/components/doc/configuration/locale/importdoc';
import { RepositoryDoc } from '@/components/doc/configuration/locale/repositorydoc';
import { SetLocaleDoc } from '@/components/doc/configuration/locale/setlocaledoc';
import { SetupLocaleDoc } from '@/components/doc/configuration/locale/setuplocaledoc';
import { NonceDoc } from '@/components/doc/configuration/noncedoc';
import { NullSortOrderDoc } from '@/components/doc/configuration/nullsortorderdoc';
import { RippleDoc } from '@/components/doc/configuration/rippledoc';
import { StyleContainer } from '@/components/doc/configuration/stylecontainer';
import { ZIndexDoc } from '@/components/doc/configuration/zindexdoc';

const InstallationPage = () => {
Expand Down Expand Up @@ -70,6 +71,11 @@ const InstallationPage = () => {
id: 'Locale',
label: 'Locale',
children: [
{
id: 'setup',
label: 'Setup',
component: SetupLocaleDoc
},
{
id: 'import',
label: 'Import',
Expand Down

0 comments on commit f2d49de

Please sign in to comment.