Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 692b03f

Browse files
committed
Internationalise the drop targets
Unsure how these had got missed (and yet still had the translation strings in the json)
1 parent 17899dd commit 692b03f

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/components/views/rooms/RoomList.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,28 @@ var Receipt = require('../../../utils/Receipt');
3333

3434
const HIDE_CONFERENCE_CHANS = true;
3535

36-
const VERBS = {
37-
'm.favourite': 'favourite',
38-
'im.vector.fake.direct': 'tag direct chat',
39-
'im.vector.fake.recent': 'restore',
40-
'm.lowpriority': 'demote',
36+
function phraseForSection(section) {
37+
// These would probably be better as individual strings,
38+
// but for some reason we have translations for these strings
39+
// as-is, so keeping it like this for now.
40+
let verb;
41+
switch (section) {
42+
case 'm.favourite':
43+
verb = _t('to favourite');
44+
break;
45+
case 'im.vector.fake.direct':
46+
verb = _t('to tag direct chat');
47+
break;
48+
case 'im.vector.fake.recent':
49+
verb = _t('to restore');
50+
break;
51+
case 'm.lowpriority':
52+
verb = _t('to demote');
53+
break;
54+
default:
55+
return _t('Drop here to tag %(section)s', {section: section});
56+
}
57+
return _t('Drop here %(toAction)s', {toAction: verb});
4158
};
4259

4360
module.exports = React.createClass({
@@ -505,7 +522,7 @@ module.exports = React.createClass({
505522
return null;
506523
}
507524

508-
const labelText = 'Drop here to ' + (VERBS[section] || 'tag ' + section);
525+
const labelText = phraseForSection(section);
509526

510527
return <RoomDropTarget label={labelText} />;
511528
},

0 commit comments

Comments
 (0)