File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { atom , getDefaultStore , useAtomValue } from 'jotai'
2
2
import { atomWithStorage } from 'jotai/utils'
3
- import { isObject , isString } from 'lodash-es'
3
+ import { get , isObject , isString } from 'lodash-es'
4
4
import mitt from 'mitt'
5
5
import { Fragment , ReactElement , ReactNode , createElement } from 'react'
6
6
import { ValueOf } from 'type-fest'
@@ -126,7 +126,9 @@ function createDeferredProxy(path: string) {
126
126
if ( Object . prototype . hasOwnProperty . call ( target , prop ) ) {
127
127
return target [ prop ]
128
128
}
129
- target [ prop ] = createDeferredProxy ( path + '.' + String ( prop ) )
129
+ target [ prop ] = createDeferredProxy (
130
+ ( path ? path + '.' : '' ) + String ( prop ) ,
131
+ )
130
132
return target [ prop ]
131
133
} ,
132
134
apply ( target , _this , args ) {
@@ -136,6 +138,12 @@ function createDeferredProxy(path: string) {
136
138
}
137
139
return updatedValue
138
140
}
141
+ if ( currentTranslations ) {
142
+ const translated = get ( currentTranslations , path )
143
+ if ( translated ) {
144
+ return translated
145
+ }
146
+ }
139
147
return toString ( )
140
148
} ,
141
149
} )
You can’t perform that action at this time.
0 commit comments