mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +00:00
PM-19281 localize relevant notification bar text (#14327)
* PM-19281 localize todo text * update storybook
This commit is contained in:
@@ -8,24 +8,24 @@ export function CipherAction({
|
|||||||
handleAction = () => {
|
handleAction = () => {
|
||||||
/* no-op */
|
/* no-op */
|
||||||
},
|
},
|
||||||
|
i18n,
|
||||||
notificationType,
|
notificationType,
|
||||||
theme,
|
theme,
|
||||||
}: {
|
}: {
|
||||||
handleAction?: (e: Event) => void;
|
handleAction?: (e: Event) => void;
|
||||||
|
i18n: { [key: string]: string };
|
||||||
notificationType: typeof NotificationTypes.Change | typeof NotificationTypes.Add;
|
notificationType: typeof NotificationTypes.Change | typeof NotificationTypes.Add;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
}) {
|
}) {
|
||||||
return notificationType === NotificationTypes.Change
|
return notificationType === NotificationTypes.Change
|
||||||
? BadgeButton({
|
? BadgeButton({
|
||||||
buttonAction: handleAction,
|
buttonAction: handleAction,
|
||||||
// @TODO localize
|
buttonText: i18n.notificationUpdate,
|
||||||
buttonText: "Update",
|
|
||||||
theme,
|
theme,
|
||||||
})
|
})
|
||||||
: EditButton({
|
: EditButton({
|
||||||
buttonAction: handleAction,
|
buttonAction: handleAction,
|
||||||
// @TODO localize
|
buttonText: i18n.notificationEdit,
|
||||||
buttonText: "Edit",
|
|
||||||
theme,
|
theme,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,13 @@ const cipherIconWidth = "24px";
|
|||||||
export function CipherItem({
|
export function CipherItem({
|
||||||
cipher,
|
cipher,
|
||||||
handleAction,
|
handleAction,
|
||||||
|
i18n,
|
||||||
notificationType,
|
notificationType,
|
||||||
theme = ThemeTypes.Light,
|
theme = ThemeTypes.Light,
|
||||||
}: {
|
}: {
|
||||||
cipher: NotificationCipherData;
|
cipher: NotificationCipherData;
|
||||||
handleAction?: (e: Event) => void;
|
handleAction?: (e: Event) => void;
|
||||||
|
i18n: { [key: string]: string };
|
||||||
notificationType?: NotificationType;
|
notificationType?: NotificationType;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
}) {
|
}) {
|
||||||
@@ -34,7 +36,7 @@ export function CipherItem({
|
|||||||
|
|
||||||
if (notificationType === NotificationTypes.Change || notificationType === NotificationTypes.Add) {
|
if (notificationType === NotificationTypes.Change || notificationType === NotificationTypes.Add) {
|
||||||
cipherActionButton = html`<div>
|
cipherActionButton = html`<div>
|
||||||
${CipherAction({ handleAction, notificationType, theme })}
|
${CipherAction({ handleAction, i18n, notificationType, theme })}
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { CipherAction } from "../../cipher/cipher-action";
|
|||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
handleAction?: (e: Event) => void;
|
handleAction?: (e: Event) => void;
|
||||||
|
i18n: { [key: string]: string };
|
||||||
notificationType: typeof NotificationTypes.Change | typeof NotificationTypes.Add;
|
notificationType: typeof NotificationTypes.Change | typeof NotificationTypes.Add;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { NotificationBody } from "../../notification/body";
|
|||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
ciphers: NotificationCipherData[];
|
ciphers: NotificationCipherData[];
|
||||||
|
i18n: { [key: string]: string };
|
||||||
notificationType: NotificationType;
|
notificationType: NotificationType;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
handleEditOrUpdateAction: (e: Event) => void;
|
handleEditOrUpdateAction: (e: Event) => void;
|
||||||
|
|||||||
@@ -17,12 +17,14 @@ const { css } = createEmotion({
|
|||||||
|
|
||||||
export function NotificationBody({
|
export function NotificationBody({
|
||||||
ciphers = [],
|
ciphers = [],
|
||||||
|
i18n,
|
||||||
notificationType,
|
notificationType,
|
||||||
theme = ThemeTypes.Light,
|
theme = ThemeTypes.Light,
|
||||||
handleEditOrUpdateAction,
|
handleEditOrUpdateAction,
|
||||||
}: {
|
}: {
|
||||||
ciphers?: NotificationCipherData[];
|
ciphers?: NotificationCipherData[];
|
||||||
customClasses?: string[];
|
customClasses?: string[];
|
||||||
|
i18n: { [key: string]: string };
|
||||||
notificationType?: NotificationType;
|
notificationType?: NotificationType;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
handleEditOrUpdateAction: (e: Event) => void;
|
handleEditOrUpdateAction: (e: Event) => void;
|
||||||
@@ -37,6 +39,7 @@ export function NotificationBody({
|
|||||||
theme,
|
theme,
|
||||||
children: CipherItem({
|
children: CipherItem({
|
||||||
cipher,
|
cipher,
|
||||||
|
i18n,
|
||||||
notificationType,
|
notificationType,
|
||||||
theme,
|
theme,
|
||||||
handleAction: handleEditOrUpdateAction,
|
handleAction: handleEditOrUpdateAction,
|
||||||
|
|||||||
@@ -22,17 +22,19 @@ function getVaultIconByProductTier(productTierType?: ProductTierType): Option["i
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type NotificationButtonRowProps = {
|
export type NotificationButtonRowProps = {
|
||||||
theme: Theme;
|
folders?: FolderView[];
|
||||||
|
i18n: { [key: string]: string };
|
||||||
|
organizations?: OrgView[];
|
||||||
primaryButton: {
|
primaryButton: {
|
||||||
text: string;
|
text: string;
|
||||||
handlePrimaryButtonClick: (args: any) => void;
|
handlePrimaryButtonClick: (args: any) => void;
|
||||||
};
|
};
|
||||||
folders?: FolderView[];
|
theme: Theme;
|
||||||
organizations?: OrgView[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function NotificationButtonRow({
|
export function NotificationButtonRow({
|
||||||
folders,
|
folders,
|
||||||
|
i18n,
|
||||||
organizations,
|
organizations,
|
||||||
primaryButton,
|
primaryButton,
|
||||||
theme,
|
theme,
|
||||||
@@ -40,7 +42,7 @@ export function NotificationButtonRow({
|
|||||||
const currentUserVaultOption: Option = {
|
const currentUserVaultOption: Option = {
|
||||||
icon: User,
|
icon: User,
|
||||||
default: true,
|
default: true,
|
||||||
text: "My vault", // @TODO localize
|
text: i18n.myVault,
|
||||||
value: "0",
|
value: "0",
|
||||||
};
|
};
|
||||||
const organizationOptions: Option[] = organizations?.length
|
const organizationOptions: Option[] = organizations?.length
|
||||||
@@ -84,7 +86,7 @@ export function NotificationButtonRow({
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
id: "organization",
|
id: "organization",
|
||||||
label: "Vault", // @TODO localize
|
label: i18n.vault,
|
||||||
options: organizationOptions,
|
options: organizationOptions,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -93,7 +95,7 @@ export function NotificationButtonRow({
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
id: "folder",
|
id: "folder",
|
||||||
label: "Folder", // @TODO localize
|
label: i18n.folder,
|
||||||
options: folderOptions,
|
options: folderOptions,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export function NotificationContainer({
|
|||||||
ciphers,
|
ciphers,
|
||||||
notificationType: type,
|
notificationType: type,
|
||||||
theme,
|
theme,
|
||||||
|
i18n,
|
||||||
})
|
})
|
||||||
: null}
|
: null}
|
||||||
${NotificationFooter({
|
${NotificationFooter({
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export function NotificationFooter({
|
|||||||
? NotificationButtonRow({
|
? NotificationButtonRow({
|
||||||
folders,
|
folders,
|
||||||
organizations,
|
organizations,
|
||||||
|
i18n,
|
||||||
primaryButton: {
|
primaryButton: {
|
||||||
handlePrimaryButtonClick: handleSaveAction,
|
handlePrimaryButtonClick: handleSaveAction,
|
||||||
text: primaryButtonText,
|
text: primaryButtonText,
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ function getI18n() {
|
|||||||
return {
|
return {
|
||||||
appName: chrome.i18n.getMessage("appName"),
|
appName: chrome.i18n.getMessage("appName"),
|
||||||
close: chrome.i18n.getMessage("close"),
|
close: chrome.i18n.getMessage("close"),
|
||||||
|
collection: chrome.i18n.getMessage("collection"),
|
||||||
folder: chrome.i18n.getMessage("folder"),
|
folder: chrome.i18n.getMessage("folder"),
|
||||||
loginSaveSuccess: chrome.i18n.getMessage("loginSaveSuccess"),
|
loginSaveSuccess: chrome.i18n.getMessage("loginSaveSuccess"),
|
||||||
loginSaveSuccessDetails: chrome.i18n.getMessage("loginSaveSuccessDetails"),
|
loginSaveSuccessDetails: chrome.i18n.getMessage("loginSaveSuccessDetails"),
|
||||||
@@ -63,10 +64,11 @@ function getI18n() {
|
|||||||
nextSecurityTaskAction: chrome.i18n.getMessage("nextSecurityTaskAction"),
|
nextSecurityTaskAction: chrome.i18n.getMessage("nextSecurityTaskAction"),
|
||||||
newItem: chrome.i18n.getMessage("newItem"),
|
newItem: chrome.i18n.getMessage("newItem"),
|
||||||
never: chrome.i18n.getMessage("never"),
|
never: chrome.i18n.getMessage("never"),
|
||||||
|
myVault: chrome.i18n.getMessage("myVault"),
|
||||||
notificationAddDesc: chrome.i18n.getMessage("notificationAddDesc"),
|
notificationAddDesc: chrome.i18n.getMessage("notificationAddDesc"),
|
||||||
notificationAddSave: chrome.i18n.getMessage("notificationAddSave"),
|
notificationAddSave: chrome.i18n.getMessage("notificationAddSave"),
|
||||||
notificationChangeDesc: chrome.i18n.getMessage("notificationChangeDesc"),
|
notificationChangeDesc: chrome.i18n.getMessage("notificationChangeDesc"),
|
||||||
notificationChangeSave: chrome.i18n.getMessage("notificationChangeSave"),
|
notificationUpdate: chrome.i18n.getMessage("notificationChangeSave"),
|
||||||
notificationEdit: chrome.i18n.getMessage("edit"),
|
notificationEdit: chrome.i18n.getMessage("edit"),
|
||||||
notificationUnlock: chrome.i18n.getMessage("notificationUnlock"),
|
notificationUnlock: chrome.i18n.getMessage("notificationUnlock"),
|
||||||
notificationUnlockDesc: chrome.i18n.getMessage("notificationUnlockDesc"),
|
notificationUnlockDesc: chrome.i18n.getMessage("notificationUnlockDesc"),
|
||||||
@@ -78,6 +80,7 @@ function getI18n() {
|
|||||||
typeLogin: chrome.i18n.getMessage("typeLogin"),
|
typeLogin: chrome.i18n.getMessage("typeLogin"),
|
||||||
updateLoginAction: chrome.i18n.getMessage("updateLoginAction"),
|
updateLoginAction: chrome.i18n.getMessage("updateLoginAction"),
|
||||||
updateLoginPrompt: chrome.i18n.getMessage("updateLoginPrompt"),
|
updateLoginPrompt: chrome.i18n.getMessage("updateLoginPrompt"),
|
||||||
|
vault: chrome.i18n.getMessage("vault"),
|
||||||
view: chrome.i18n.getMessage("view"),
|
view: chrome.i18n.getMessage("view"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -200,7 +203,7 @@ async function initNotificationBar(message: NotificationBarWindowMessage) {
|
|||||||
const changeTemplate = document.getElementById("template-change") as HTMLTemplateElement;
|
const changeTemplate = document.getElementById("template-change") as HTMLTemplateElement;
|
||||||
|
|
||||||
const changeButton = findElementById<HTMLSelectElement>(changeTemplate, "change-save");
|
const changeButton = findElementById<HTMLSelectElement>(changeTemplate, "change-save");
|
||||||
changeButton.textContent = i18n.notificationChangeSave;
|
changeButton.textContent = i18n.notificationUpdate;
|
||||||
|
|
||||||
const changeEditButton = findElementById<HTMLButtonElement>(changeTemplate, "change-edit");
|
const changeEditButton = findElementById<HTMLButtonElement>(changeTemplate, "change-edit");
|
||||||
changeEditButton.textContent = i18n.notificationEdit;
|
changeEditButton.textContent = i18n.notificationEdit;
|
||||||
|
|||||||
Reference in New Issue
Block a user