From 19de32e206315db654b5b9a8bcb89dde8ce5c0e3 Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Wed, 12 Apr 2017 17:19:37 -0700 Subject: [PATCH] feat: support directly setting dialog title text Dialog does not currently support displaying dynamic strings for titles, only static strings listed for translation. Accept a new prop that explicitly states it is for setting the title and have the web dialog prefer it over the titleKey. --- react/features/base/dialog/components/AbstractDialog.js | 9 ++++++++- react/features/base/dialog/components/Dialog.web.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/react/features/base/dialog/components/AbstractDialog.js b/react/features/base/dialog/components/AbstractDialog.js index ae75ea57c..328fedadb 100644 --- a/react/features/base/dialog/components/AbstractDialog.js +++ b/react/features/base/dialog/components/AbstractDialog.js @@ -56,7 +56,14 @@ export default class AbstractDialog extends Component { /** * Key to use for showing a title. */ - titleKey: React.PropTypes.string + titleKey: React.PropTypes.string, + + /** + * The string to use as a title instead of {@code titleKey}. If a truthy + * value is specified, it takes precedence over {@code titleKey} i.e. + * the latter is unused. + */ + titleString: React.PropTypes.string } /** diff --git a/react/features/base/dialog/components/Dialog.web.js b/react/features/base/dialog/components/Dialog.web.js index ba67dbd09..5a19ac0ae 100644 --- a/react/features/base/dialog/components/Dialog.web.js +++ b/react/features/base/dialog/components/Dialog.web.js @@ -114,7 +114,7 @@ class Dialog extends AbstractDialog { return (

- { t(this.props.titleKey) } + { this.props.titleString || t(this.props.titleKey) }

);