diff options
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/utils.jsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 16e208409..3bf877781 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -31,11 +31,19 @@ export function isMac() { return navigator.platform.toUpperCase().indexOf('MAC') >= 0; } -export function createSafeId(str) { - if (str === null) { +export function createSafeId(prop) { + if (prop === null) { return null; } + var str = ''; + + if (prop.props && prop.props.defaultMessage) { + str = prop.props.defaultMessage; + } else { + str = prop.toString(); + } + return str.replace(new RegExp(' ', 'g'), '_'); } |