Skip to content

Commit 163533a

Browse files
PR feedback
1 parent 99f1e94 commit 163533a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
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": [

src/oceans/i18n.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import MessageFormat from 'messageformat'
33

44
let messages;
55
export const init = (i18n = {}) => {
6+
// For now, use English pluralization rules.
67
const mf = new MessageFormat('en');
78
messages = {...mf.compile(data), ...i18n};
89
};
910

1011
export 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
};

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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==

0 commit comments

Comments
 (0)