Skip to content

Commit

Permalink
add translations + autoincremental id for snackbars
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoecheza committed Jul 22, 2024
1 parent 031c565 commit e4add0b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/renderer/src/components/SceneList/component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback } from 'react';
import { Select, MenuItem, type SelectChangeEvent, Box } from 'decentraland-ui2';

import { SortBy } from '/shared/types/projects';
import { t } from '/@/modules/store/translation/utils';
import { SceneCreationSelector } from '/@/components/SceneCreationSelector';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from 'react';
import { Alert } from 'decentraland-ui2';

import { t } from '/@/modules/store/translation/utils';
import { useWorkspace } from '/@/hooks/useWorkspace';

import { Button } from '../../Button';
Expand Down Expand Up @@ -32,14 +33,14 @@ export function MissingScenes({ onClose }: { onClose: () => void }) {
size="small"
onClick={handleModal(true)}
>
View
{t('snackbar.missing_projects.actions.view')}
</Button>
<Button
color="inherit"
size="small"
onClick={handleDiscardAll}
>
Discard all
{t('snackbar.missing_projects.actions.discard_all')}
</Button>
</>
);
Expand All @@ -50,7 +51,7 @@ export function MissingScenes({ onClose }: { onClose: () => void }) {
severity="error"
action={renderActions()}
>
{missing.length} missing scenes found
{t('snackbar.missing_projects.title', { scenes: missing.length })}
</Alert>
<MissingProjects
open={open}
Expand Down
4 changes: 3 additions & 1 deletion packages/renderer/src/modules/store/snackbar/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { CustomNotification, GenericNotification, NotificationId, Severity } from './types';

let incrementalId = 0;

function getId<T extends string>(type: T): NotificationId<T> {
return `${type}_${Date.now()}`;
return `${type}_${++incrementalId}`;
}

export function createCustomNotification(type: CustomNotification['type']): CustomNotification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
}
}
},
"snackbar": {
"missing_projects": {
"title": "{scenes} missing {scenes, plural, one {scene} other {scenes}} found",
"actions": {
"view": "View",
"discard_all": "Discard all"
}
}
},
"option_box": {
"learn_more": "Learn more"
}
Expand Down
11 changes: 10 additions & 1 deletion packages/renderer/src/modules/store/translation/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"size": "Tamaño"
},
"results": "{count} {count, plural, one {resultado} other {resultados}}",
"parcel_count": "{parcels} {parcels, plural, one {parcel} other {parcels}}"
"parcel_count": "{parcels} {parcels, plural, one {parcela} other {parcelas}}"
},
"modal": {
"cancel": "Cancelar",
Expand Down Expand Up @@ -78,6 +78,15 @@
}
}
},
"snackbar": {
"missing_projects": {
"title": "{scenes} {scenes, plural, one {escena} other {escenas}} {scenes, plural, one {faltante} other {faltantes}}",
"actions": {
"view": "Ver",
"discard_all": "Descartar todas"
}
}
},
"option_box": {
"learn_more": "Learn more"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
}
}
},
"snackbar": {
"missing_projects": {
"title": "{scenes} 丢失的 {scenes, plural, one {场景} other {场景}} 成立",
"actions": {
"view": "版本",
"discard_all": "全部丢弃"
}
}
},
"option_box": {
"learn_more": "了解更多"
}
Expand Down

0 comments on commit e4add0b

Please sign in to comment.