File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,23 @@ class Intl {
1515 this . lang = lang
1616 }
1717 tl ( key : string ) {
18- this . tokens . add ( key )
19- let v = this . dict [ this . lang ] ?. [ key ] ? this . dict [ this . lang ] [ key ] : key
20- // if (v === key) debugger
21- return v
18+ let segments = key . split ( '.' )
19+ let dict = this . dict [ this . lang ]
20+ for ( let i = 0 ; i < segments . length ; i ++ ) {
21+ if ( dict [ segments [ i ] ] ) {
22+ dict = dict [ segments [ i ] ]
23+ } else {
24+ this . tokens . add ( key )
25+ return key
26+ }
27+ }
28+ return typeof dict === 'string' ? dict : key
2229 }
2330 register ( name : string , dict : any ) {
2431 this . dict [ name ] = dict
2532 }
2633 diff ( showDefaultValues : boolean ) {
34+ throw new Error ( 'Not implemented' )
2735 let root = this . dict . en
2836 let diff = [ ]
2937 for ( let lang in this . dict ) {
You can’t perform that action at this time.
0 commit comments