File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 101101 "@fortawesome/fontawesome-svg-core" : " ^1.2.25" ,
102102 "@fortawesome/free-solid-svg-icons" : " ^5.11.2" ,
103103 "@fortawesome/react-fontawesome" : " ^0.1.7" ,
104- "messageformat" : " ^1.0 .0" ,
104+ "messageformat" : " ^1.1 .0" ,
105105 "react-typist" : " ^2.0.5"
106106 },
107107 "files" : [
Original file line number Diff line number Diff line change @@ -3,10 +3,14 @@ import MessageFormat from 'messageformat'
33
44let messages ;
55export const init = ( i18n = { } ) => {
6+ // For now, use English pluralization rules.
67 const mf = new MessageFormat ( 'en' ) ;
78 messages = { ...mf . compile ( data ) , ...i18n } ;
89} ;
910
1011export const t = ( key , options ) => {
11- return messages [ key ] ( options ) ;
12+ if ( ! messages ) {
13+ throw "I18n must be initialized before calling t" ;
14+ }
15+ return messages [ key ] ( options ) ;
1216} ;
Original file line number Diff line number Diff line change @@ -5441,7 +5441,7 @@ messageformat-parser@^1.1.0:
54415441 resolved "https://registry.yarnpkg.com/messageformat-parser/-/messageformat-parser-1.1.0.tgz#13ba2250a76bbde8e0fca0dbb3475f95c594a90a"
54425442 integrity sha512-Hwem6G3MsKDLS1FtBRGIs8T50P1Q00r3srS6QJePCFbad9fq0nYxwf3rnU2BreApRGhmpKMV7oZI06Sy1c9TPA==
54435443
5444- messageformat@^1.0 .0 :
5444+ messageformat@^1.1 .0 :
54455445 version "1.1.1"
54465446 resolved "https://registry.yarnpkg.com/messageformat/-/messageformat-1.1.1.tgz#ceaa2e6c86929d4807058275a7372b1bd963bdf6"
54475447 integrity sha512-Q0uXcDtF5pEZsVSyhzDOGgZZK6ykN79VY9CwU3Nv0gsqx62BjdJW0MT+63UkHQ4exe3HE33ZlxR2/YwoJarRTg==
You can’t perform that action at this time.
0 commit comments