aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/metamask-connect.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-03-30 00:37:29 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-03-30 00:37:29 +0800
commitef61ef2ce885635862bb242612dd821cb3a65b6b (patch)
tree0f128f8b56b57a1bbe96dcf5743d34b5f95dc4cc /ui/app/metamask-connect.js
parent58f52b2b8de9efd43896e23ab0ac9972f45bb278 (diff)
parent8766420f19251b95211dd99ff9a45e60cf0177ad (diff)
downloadtangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.gz
tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.tar.zst
tangerine-wallet-browser-ef61ef2ce885635862bb242612dd821cb3a65b6b.zip
Fix i18n merge conflicts
Diffstat (limited to 'ui/app/metamask-connect.js')
-rw-r--r--ui/app/metamask-connect.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/ui/app/metamask-connect.js b/ui/app/metamask-connect.js
new file mode 100644
index 000000000..8da594635
--- /dev/null
+++ b/ui/app/metamask-connect.js
@@ -0,0 +1,27 @@
+const connect = require('react-redux').connect
+const t = require('../i18n-helper').getMessage
+
+const metamaskConnect = (mapStateToProps, mapDispatchToProps) => {
+ return connect(
+ _higherOrderMapStateToProps(mapStateToProps),
+ mapDispatchToProps
+ )
+}
+
+const _higherOrderMapStateToProps = (mapStateToProps) => {
+ let _t
+ let currentLocale
+ return (state, ownProps = {}) => {
+ const stateProps = mapStateToProps
+ ? mapStateToProps(state, ownProps)
+ : ownProps
+ if (currentLocale !== state.metamask.currentLocale) {
+ currentLocale = state.metamask.currentLocale
+ _t = t.bind(null, state.localeMessages)
+ }
+ stateProps.t = _t
+ return stateProps
+ }
+}
+
+module.exports = metamaskConnect \ No newline at end of file