File tree Expand file tree Collapse file tree 11 files changed +41
-123
lines changed
packages/pydantic-forms/src Expand file tree Collapse file tree 11 files changed +41
-123
lines changed Original file line number Diff line number Diff line change 11{
22 "footer" : {
3- "cancel" : " Cancel" ,
3+ "cancel" : " Cancel CUSTOM " ,
44 "send" : " Send CUSTOM" ,
5- "reset" : " Reset" ,
6- "notModifiedYet" : " The form has not been modified yet" ,
7- "notFilledYet" : " The form has not been filled in yet"
5+ "reset" : " Reset CUSTOM " ,
6+ "notModifiedYet" : " The form has not been modified yet CUSTOM " ,
7+ "notFilledYet" : " The form has not been filled in yet CUSTOM "
88 },
99 "renderForm" : {
10- "loading" : " Form is loading..." ,
11- "successfullySent" : " Your submission has been successfully received"
10+ "loading" : " Form is loading... CUSTOM " ,
11+ "successfullySent" : " Your submission has been successfully received CUSTOM "
1212 }
1313}
Original file line number Diff line number Diff line change 11{
22 "footer" : {
3- "cancel" : " Annuleren" ,
3+ "cancel" : " Annuleren CUSTOM " ,
44 "send" : " Verzenden CUSTOM" ,
5- "reset" : " Resetten" ,
6- "notModifiedYet" : " Het formulier is nog niet aangepast" ,
7- "notFilledYet" : " Het formulier is nog niet ingevuld"
5+ "reset" : " Resetten CUSTOM " ,
6+ "notModifiedYet" : " Het formulier is nog niet aangepast CUSTOM " ,
7+ "notFilledYet" : " Het formulier is nog niet ingevuld CUSTOM "
88},
99 "renderForm" : {
10- "loading" : " Formulier wordt geladen..." ,
11- "successfullySent" : " ' Je inzending is succesvol ontvangen' "
10+ "loading" : " Formulier wordt geladen... CUSTOM " ,
11+ "successfullySent" : " Je inzending is succesvol ontvangen CUSTOM "
1212 }
1313}
Original file line number Diff line number Diff line change @@ -123,11 +123,16 @@ export default function Home() {
123123 labelProvider : pydanticLabelProvider ,
124124 customDataProvider : pydanticCustomDataProvider ,
125125 componentMatcher : componentMatcher ,
126+ < << << << HEAD
126127< < << << < HEAD
127128 translations : NLnl ,
128129= === ===
129130 translations : useGetTranslationMessages ( validLocale )
130131> > >>> >> 6 b4540b ( Cleanup )
132+ = === ===
133+ translations : useGetTranslationMessages ( validLocale ) , //Comment this line for default translations
134+ locale : validLocale
135+ >>> > >>> 07848e9 ( Some refactor )
131136 } }
132137 />
133138 </ div >
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import type {
1414 PydanticFormInitialContextProps ,
1515 PydanticFormMetaData ,
1616} from '@/types' ;
17- import { TranslationsProvider } from "@/core/translations /translationsProvider" ;
17+ import { TranslationsProvider } from "@/messages /translationsProvider" ;
1818
1919export interface PydanticFormProps
2020 extends Omit < PydanticFormInitialContextProps , 'formKey' | 'children' > {
@@ -27,7 +27,7 @@ export const PydanticForm = ({
2727 metaData,
2828 ...contextProps
2929} : PydanticFormProps ) => (
30- < TranslationsProvider translations = { contextProps . config . translations } >
30+ < TranslationsProvider translations = { contextProps . config . translations } locale = { contextProps . config . locale } >
3131 < PydanticFormContextProvider
3232 { ...contextProps }
3333 formKey = { id }
Original file line number Diff line number Diff line change @@ -69,10 +69,6 @@ const RenderForm = (contextProps: PydanticFormContextProps) => {
6969 customComponentMatcher ,
7070 ) ;
7171
72- console . log ( 'pydanticFormComponents' , pydanticFormComponents ) ;
73- console . log ( "pydanticFormSchema" , pydanticFormSchema )
74- console . log ( "customComponentMatcher" , customComponentMatcher )
75-
7672 return (
7773 < form action = { '' } onSubmit = { submitForm } >
7874 { title !== false &&
Original file line number Diff line number Diff line change @@ -42,8 +42,6 @@ import {
4242import { getHashForArray } from '@/utils' ;
4343
4444import translation from './translations/nl.json' ;
45- import { TranslationsProvider } from "@/core/translations/translationsProvider" ;
46-
4745// lng and resources key depend on your locale.
4846i18next . init ( {
4947 lng : 'nl' ,
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11{
22 "footer" : {
3- "cancel" : " Default Cancel" ,
4- "send" : " Default Send" ,
5- "reset" : " Default Reset" ,
6- "notModifiedYet" : " Default Het formulier is nog niet aangepast" ,
7- "notFilledYet" : " Default Het formulier is nog niet ingevuld" ,
8- "yola" : {
9- "poweredBy" : " Default Powered by"
10- },
11- "hola" : {
12- "dolla" : {
13- "poweredBy" : " Default Powered by"
14- }
15- }
3+ "cancel" : " Cancel" ,
4+ "send" : " Send" ,
5+ "reset" : " Reset" ,
6+ "notModifiedYet" : " The form has not been modified yet" ,
7+ "notFilledYet" : " The form has not been filled in yet"
168 },
17- "renderForm" : {
18- "loading" : " Default Formulier wordt geladen ..." ,
19- "successfullySent" : " 'Je inzending is succesvol ontvangen' "
9+ "renderForm" : {
10+ "loading" : " Form is loading ..." ,
11+ "successfullySent" : " Your submission has been successfully received "
2012 }
2113}
Original file line number Diff line number Diff line change @@ -12,27 +12,29 @@ export enum Locale {
1212 nlNL = 'nl-NL' ,
1313}
1414
15+ const DEFAULT_TIMEZONE = 'Europe/Amsterdam' ;
16+
1517interface TranslationsProviderProps {
1618 translations : TranslationsJSON | undefined ;
19+ locale ?: string ;
1720 children : ReactNode ;
1821}
1922
2023export const TranslationsProvider = ( {
2124 translations,
25+ locale = Locale . enGB ,
2226 children,
2327} : TranslationsProviderProps ) => {
2428
25- const locale : Locale = Locale . nlNL ; // TODO: get locale from router
2629 const getCustomMessages = ( translations : TranslationsJSON | undefined ) => {
2730 return translations ;
2831 }
29- const getLocalMessages = ( locale : Locale ) => {
32+ const getLocalMessages = ( locale : string ) => {
3033 switch ( locale ) {
3134 case Locale . enGB :
3235 return enGB ;
3336 case Locale . nlNL :
3437 return nlNL ;
35-
3638 default :
3739 return enGB ;
3840 }
@@ -59,6 +61,7 @@ export const TranslationsProvider = ({
5961 < NextIntlClientProvider
6062 locale = { locale || Locale . enGB }
6163 messages = { messages }
64+ timeZone = { DEFAULT_TIMEZONE }
6265 onError = { onError }
6366 >
6467 { children }
You can’t perform that action at this time.
0 commit comments