From ced68f2719fd3a503b1246d0d8c02a5f9078233f Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 1 Jun 2017 15:53:08 +0100 Subject: [PATCH] Find a way to translate the name of RTE in user settings I never said it was a *nice* way... --- src/UserSettingsStore.js | 12 +++++++----- src/components/structures/UserSettings.js | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 5b96692dc9..84d85e7565 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -17,24 +17,26 @@ limitations under the License. import q from 'q'; import MatrixClientPeg from './MatrixClientPeg'; import Notifier from './Notifier'; +import { _t } from './languageHandler'; /* * TODO: Make things use this. This is all WIP - see UserSettings.js for usage. */ -/* - * TODO: Find a way to translate the names of LABS_FEATURES. In other words, guarantee that languages were already loaded before building this array. - */ - export default { LABS_FEATURES: [ { - name: "New Composer & Autocomplete", + name: "-", id: 'rich_text_editor', default: false, }, ], + // horrible but it works. The locality makes this somewhat more palatable. + doTranslations: function() { + this.LABS_FEATURES[0].name = _t("New Composer & Autocomplete"); + }, + loadProfileInfo: function() { const cli = MatrixClientPeg.get(); return cli.getProfileInfo(cli.credentials.userId); diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 101ec2c378..a4238fe392 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -767,6 +767,7 @@ module.exports = React.createClass({ _renderLabs: function() { // default to enabled if undefined if (this.props.enableLabs === false) return null; + UserSettingsStore.doTranslations(); const features = UserSettingsStore.LABS_FEATURES.map((feature) => (