From ebec09950ae65a8d8f17c452f4fa41dc790efadc Mon Sep 17 00:00:00 2001 From: Gege Date: Mon, 3 Jun 2019 12:53:54 +0200 Subject: [PATCH] Revert JS regexp. Fixes #8 --- CHANGELOG.md | 4 ++++ resources/js/I18n.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84fb118..0e1ffe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.6.2 (2018-06-03 ) +### Changed +- revet JS regexp to have better browser support + ## v0.6.1 (2018-06-03 ) ### Fixed - use concat in JS instead of push diff --git a/resources/js/I18n.js b/resources/js/I18n.js index 1b42cfa..601901b 100644 --- a/resources/js/I18n.js +++ b/resources/js/I18n.js @@ -101,9 +101,13 @@ export default class I18n */ _extract(key, value = null) { - let path = key.toString().split(/(?<=::)/), + let path = key.toString().split('::'), keys = path.pop().toString().split('.'); + if (path.length > 0) { + path[0] += '::'; + } + return path.concat(keys).reduce((t, i) => t[i] || (value || key), window[this.key]); } }