From 66fc202b5c54c3bd9a7e1fd26610d056b58cc5f6 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Apr 2021 19:40:18 -0700 Subject: [PATCH] fix: internationalize dialogs (#2033) * fix: internationalize dialogs Fixes #1988 * test: fix test * test: fix test * Revert "test: fix test" This reverts commit 559e3d80eb8d65f7ab9443966d4fcfd087e4f8f0. --- src/intl/en-US.js | 12 +++++++++++- .../_components/dialog/components/ModalDialog.html | 2 +- .../creators/showAccountProfileOptionsDialog.js | 2 +- .../_components/dialog/creators/showComposeDialog.js | 2 +- .../_components/dialog/creators/showCopyDialog.js | 4 ++-- .../_components/dialog/creators/showEmojiDialog.js | 4 ++-- .../_components/dialog/creators/showMediaDialog.js | 2 +- .../dialog/creators/showMediaEditDialog.js | 4 ++-- .../_components/dialog/creators/showMuteDialog.js | 2 +- .../dialog/creators/showPostPrivacyDialog.js | 4 ++-- .../_components/dialog/creators/showReportDialog.js | 6 ++++-- .../dialog/creators/showShortcutHelpDialog.js | 2 +- .../dialog/creators/showStatusOptionsDialog.js | 2 +- .../dialog/creators/showTextConfirmationDialog.js | 2 +- tests/utils.js | 2 +- 15 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/intl/en-US.js b/src/intl/en-US.js index c7502834..3999afeb 100644 --- a/src/intl/en-US.js +++ b/src/intl/en-US.js @@ -653,5 +653,15 @@ export default { createdFilter: 'Created filter', failedToModifyFilter: 'Failed to modify filter: {error}', deletedFilter: 'Deleted filter', - required: 'Required' + required: 'Required', + // Dialogs + profileOptions: 'Profile options', + copyLink: 'Copy link', + emoji: 'Emoji', + editMedia: 'Edit media', + shortcutHelp: 'Shortcut help', + statusOptions: 'Status options', + confirm: 'Confirm', + closeDialog: 'Close dialog', + postPrivacy: 'Post privacy' } diff --git a/src/routes/_components/dialog/components/ModalDialog.html b/src/routes/_components/dialog/components/ModalDialog.html index 37752d87..062a64fa 100644 --- a/src/routes/_components/dialog/components/ModalDialog.html +++ b/src/routes/_components/dialog/components/ModalDialog.html @@ -14,7 +14,7 @@ {/if}
diff --git a/src/routes/_components/dialog/creators/showAccountProfileOptionsDialog.js b/src/routes/_components/dialog/creators/showAccountProfileOptionsDialog.js index 35f632cd..48e8d706 100644 --- a/src/routes/_components/dialog/creators/showAccountProfileOptionsDialog.js +++ b/src/routes/_components/dialog/creators/showAccountProfileOptionsDialog.js @@ -3,7 +3,7 @@ import { showDialog } from './showDialog' export default function showAccountProfileOptionsDialog (account, relationship, verifyCredentials) { return showDialog(AccountProfileOptionsDialog, { - label: 'Profile options dialog', + label: 'intl.profileOptions', title: '', account: account, relationship: relationship, diff --git a/src/routes/_components/dialog/creators/showComposeDialog.js b/src/routes/_components/dialog/creators/showComposeDialog.js index f775af2b..d91323a6 100644 --- a/src/routes/_components/dialog/creators/showComposeDialog.js +++ b/src/routes/_components/dialog/creators/showComposeDialog.js @@ -2,5 +2,5 @@ import ComposeDialog from '../components/ComposeDialog.html' import { showDialog } from './showDialog' export default function showComposeDialog () { - return showDialog(ComposeDialog, { label: 'Compose dialog' }) + return showDialog(ComposeDialog, { label: 'intl.composeStatus' }) } diff --git a/src/routes/_components/dialog/creators/showCopyDialog.js b/src/routes/_components/dialog/creators/showCopyDialog.js index 0c2e8ea6..6a9bfa84 100644 --- a/src/routes/_components/dialog/creators/showCopyDialog.js +++ b/src/routes/_components/dialog/creators/showCopyDialog.js @@ -3,8 +3,8 @@ import { showDialog } from './showDialog' export default function showCopyDialog (text) { return showDialog(CopyDialog, { - label: 'Copy dialog', - title: 'Copy link', + label: 'intl.copyLink', + title: 'intl.copyLink', text }) } diff --git a/src/routes/_components/dialog/creators/showEmojiDialog.js b/src/routes/_components/dialog/creators/showEmojiDialog.js index c88fb621..8edc17b9 100644 --- a/src/routes/_components/dialog/creators/showEmojiDialog.js +++ b/src/routes/_components/dialog/creators/showEmojiDialog.js @@ -3,8 +3,8 @@ import { showDialog } from './showDialog' export default function showEmojiDialog (realm) { return showDialog(EmojiDialog, { - label: 'Emoji dialog', - title: 'Emoji', + label: 'intl.emoji', + title: 'intl.emoji', realm }) } diff --git a/src/routes/_components/dialog/creators/showMediaDialog.js b/src/routes/_components/dialog/creators/showMediaDialog.js index 5b32d85b..a5cd26fb 100644 --- a/src/routes/_components/dialog/creators/showMediaDialog.js +++ b/src/routes/_components/dialog/creators/showMediaDialog.js @@ -3,7 +3,7 @@ import { showDialog } from './showDialog' export default function showMediaDialog (mediaItems, scrolledItem) { return showDialog(MediaDialog, { - label: 'Media dialog', + label: 'intl.media', mediaItems, scrolledItem }) diff --git a/src/routes/_components/dialog/creators/showMediaEditDialog.js b/src/routes/_components/dialog/creators/showMediaEditDialog.js index 7eb8154c..8db018b6 100644 --- a/src/routes/_components/dialog/creators/showMediaEditDialog.js +++ b/src/routes/_components/dialog/creators/showMediaEditDialog.js @@ -3,8 +3,8 @@ import { showDialog } from './showDialog' export default function showMediaEditDialog (realm, index, type) { return showDialog(MediaFocalPointDialog, { - label: 'Edit media', - title: 'Edit media', + label: 'intl.editMedia', + title: 'intl.editMedia', realm, index, type diff --git a/src/routes/_components/dialog/creators/showMuteDialog.js b/src/routes/_components/dialog/creators/showMuteDialog.js index 69e91772..b2934de8 100644 --- a/src/routes/_components/dialog/creators/showMuteDialog.js +++ b/src/routes/_components/dialog/creators/showMuteDialog.js @@ -3,7 +3,7 @@ import { showDialog } from './showDialog' export default function showMuteDialog (account) { return showDialog(MuteDialog, { - label: 'Mute dialog', + label: 'intl.mute', account }) } diff --git a/src/routes/_components/dialog/creators/showPostPrivacyDialog.js b/src/routes/_components/dialog/creators/showPostPrivacyDialog.js index f5d0fd21..ac9abe5c 100644 --- a/src/routes/_components/dialog/creators/showPostPrivacyDialog.js +++ b/src/routes/_components/dialog/creators/showPostPrivacyDialog.js @@ -3,8 +3,8 @@ import { showDialog } from './showDialog' export default function showPostPrivacyDialog (realm) { return showDialog(PostPrivacyDialog, { - label: 'Post privacy dialog', - title: 'Post privacy', + label: 'intl.postPrivacy', + title: 'intl.postPrivacy', realm: realm }) } diff --git a/src/routes/_components/dialog/creators/showReportDialog.js b/src/routes/_components/dialog/creators/showReportDialog.js index facf4aa3..2beae76a 100644 --- a/src/routes/_components/dialog/creators/showReportDialog.js +++ b/src/routes/_components/dialog/creators/showReportDialog.js @@ -1,10 +1,12 @@ import ReportDialog from '../components/ReportDialog.html' import { showDialog } from './showDialog' +import { formatIntl } from '../../../_utils/formatIntl' export default function showReportDialog ({ account, status }) { + const label = formatIntl('intl.reportAccount', { account: `@${account.acct}` }) return showDialog(ReportDialog, { - label: 'Report dialog', - title: `Report @${account.acct}`, + label, + title: label, account, status }) diff --git a/src/routes/_components/dialog/creators/showShortcutHelpDialog.js b/src/routes/_components/dialog/creators/showShortcutHelpDialog.js index b87fb61f..f9165cee 100644 --- a/src/routes/_components/dialog/creators/showShortcutHelpDialog.js +++ b/src/routes/_components/dialog/creators/showShortcutHelpDialog.js @@ -3,6 +3,6 @@ import { showDialog } from './showDialog' export default function showShortcutHelpDialog (options) { return showDialog(ShortcutHelpDialog, Object.assign({ - label: 'shortcut help dialog' + label: 'intl.shortcutHelp' }, options)) } diff --git a/src/routes/_components/dialog/creators/showStatusOptionsDialog.js b/src/routes/_components/dialog/creators/showStatusOptionsDialog.js index ddd7c28a..342bf108 100644 --- a/src/routes/_components/dialog/creators/showStatusOptionsDialog.js +++ b/src/routes/_components/dialog/creators/showStatusOptionsDialog.js @@ -3,7 +3,7 @@ import { showDialog } from './showDialog' export default function showStatusOptionsDialog (status) { return showDialog(StatusOptionsDialog, { - label: 'Status options dialog', + label: 'intl.statusOptions', title: '', status: status }) diff --git a/src/routes/_components/dialog/creators/showTextConfirmationDialog.js b/src/routes/_components/dialog/creators/showTextConfirmationDialog.js index 2cc51555..3e92d307 100644 --- a/src/routes/_components/dialog/creators/showTextConfirmationDialog.js +++ b/src/routes/_components/dialog/creators/showTextConfirmationDialog.js @@ -3,6 +3,6 @@ import { showDialog } from './showDialog' export default function showTextConfirmationDialog (options) { return showDialog(TextConfirmationDialog, Object.assign({ - label: 'Confirmation dialog' + label: 'intl.confirm' }, options)) } diff --git a/tests/utils.js b/tests/utils.js index 3c39f582..56cbe8e7 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -81,7 +81,7 @@ export const composePollAddButton = $('.compose-poll button:last-of-type') export const composeMediaSensitiveCheckbox = $('.compose-media-sensitive input') -export const postPrivacyDialogButtonUnlisted = $('[aria-label="Post privacy dialog"] li:nth-child(2) button') +export const postPrivacyDialogButtonUnlisted = $('[aria-label="Post privacy"] li:nth-child(2) button') export const accountProfileFilterStatuses = $('.account-profile-filters li:nth-child(1)') export const accountProfileFilterStatusesAndReplies = $('.account-profile-filters li:nth-child(2)')