Skip to content

Commit f1999b1

Browse files
barshathakurisamshara
authored andcommitted
Add translation in Capacity tab
1 parent 3156ba3 commit f1999b1

8 files changed

Lines changed: 73 additions & 43 deletions

File tree

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"namespace": "activeSurgeDeployments",
33
"strings": {
4-
"emergencyResponseUnit": "Emergency Response Unit",
5-
"rapidResponsePersonnel": "Rapid Response Personnel",
6-
"deployedERUs": "ERUs Deployed",
7-
"deployedRRs": "RRs Deployed",
8-
"deployingOrganizations": "Deploying Organisation"
4+
"surgeEmergencyResponseUnit": "Emergency Response Unit",
5+
"surgeRapidResponsePersonnel": "Rapid Response Personnel",
6+
"surgeDeployedERUs": "ERUs Deployed",
7+
"surgeDeployedRRs": "RRs Deployed",
8+
"surgeDeployingOrganizations": "Deploying Organisation"
99
}
1010
}

app/src/views/ActiveSurgeDeployments/ActiveSurgeSupport/SurgeCard/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function SurgeCard(props: Props) {
100100
footerContent={(
101101
<TextOutput
102102
value={eruDeployingOrganizations}
103-
label={strings.deployingOrganizations}
103+
label={strings.surgeDeployingOrganizations}
104104
strongValue
105105
withoutLabelColon
106106
valueType="text"
@@ -110,15 +110,15 @@ function SurgeCard(props: Props) {
110110
<KeyFigure
111111
className={styles.figure}
112112
value={deployedERUCount}
113-
label={strings.emergencyResponseUnit}
113+
label={strings.surgeEmergencyResponseUnit}
114114
compactValue
115115
/>
116116
<div className={styles.separator} />
117117
<TextOutput
118118
className={styles.figure}
119119
labelClassName={styles.label}
120120
label={deployedERUTypes}
121-
value={strings.deployedERUs}
121+
value={strings.surgeDeployedERUs}
122122
strongLabel
123123
withoutLabelColon
124124
/>
@@ -134,7 +134,7 @@ function SurgeCard(props: Props) {
134134
footerContent={(
135135
<TextOutput
136136
value={personnelDeployingOrganizations}
137-
label={strings.deployingOrganizations}
137+
label={strings.surgeDeployingOrganizations}
138138
strongValue
139139
withoutLabelColon
140140
valueType="text"
@@ -144,14 +144,14 @@ function SurgeCard(props: Props) {
144144
<KeyFigure
145145
className={styles.figure}
146146
value={deployedPersonnelCount}
147-
label={strings.rapidResponsePersonnel}
147+
label={strings.surgeRapidResponsePersonnel}
148148
compactValue
149149
/>
150150
<div className={styles.separator} />
151151
<TextOutput
152152
className={styles.figure}
153153
label={deployedPersonnelTypes}
154-
value={strings.deployedRRs}
154+
value={strings.surgeDeployedRRs}
155155
strongLabel
156156
withoutLabelColon
157157
/>

app/src/views/SurgeOverview/EmergencyResponseUnit/EmergencyResponseUnitReadiness/EmergencyResponseUnitCard/i18n.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"strings": {
44
"emergencyResponseUnitOwnerCardLastUpdated": "Last updated",
55
"emergencyResponseUnitOwnerCardReady": "{count} Ready ERUs",
6-
"emergencyResponseUnitOwnerCardDeployed": "{count} Deployed ERUs"
6+
"emergencyResponseUnitOwnerCardDeployed": "{count} Deployed ERUs",
7+
"emergencyResponseUnitNationalSociety": "National Society",
8+
"eruSeeReadinessInfoButton": "See readiness info",
9+
"eruEquipmentReadiness": "Equipment Readiness",
10+
"eruPeopleReadiness": "People Readiness",
11+
"eruFundingReadiness": "Funding Readiness",
12+
"eruReadinessInformationHeading": "Readiness Information by National Society"
713
}
814
}

app/src/views/SurgeOverview/EmergencyResponseUnit/EmergencyResponseUnitReadiness/EmergencyResponseUnitCard/index.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ function EmergencyResponseUnitTypeCard(props: Props) {
8383
name={undefined}
8484
onClick={setShowReadinessInfoTrue}
8585
variant="tertiary"
86-
title="See readiness info"
86+
title={strings.eruSeeReadinessInfoButton}
8787
>
88-
See readiness info
88+
{strings.eruSeeReadinessInfoButton}
8989
</Button>
9090
)}
9191
childrenContainerClassName={styles.content}
@@ -97,7 +97,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
9797
<>
9898
<TextOutput
9999
className={styles.readiness}
100-
label="Equipment Readiness"
100+
label={strings.eruEquipmentReadiness}
101101
value={(
102102
<CheckboxCircleLineIcon
103103
className={getReadinessColor(equipmentReadiness)}
@@ -109,7 +109,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
109109
<div className={styles.separatorLeft} />
110110
<TextOutput
111111
className={styles.readiness}
112-
label="People Readiness"
112+
label={strings.eruPeopleReadiness}
113113
value={(
114114
<CheckboxCircleLineIcon
115115
className={getReadinessColor(peopleReadiness)}
@@ -121,7 +121,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
121121
<div className={styles.separatorLeft} />
122122
<TextOutput
123123
className={styles.readiness}
124-
label="Funding Readiness"
124+
label={strings.eruFundingReadiness}
125125
value={(
126126
<CheckboxCircleLineIcon
127127
className={getReadinessColor(fundingReadiness)}
@@ -135,7 +135,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
135135
>
136136
<TextOutput
137137
className={styles.eruOwners}
138-
label="National Society"
138+
label={strings.emergencyResponseUnitNationalSociety}
139139
value={nationalSocieties}
140140
strongValue
141141
withoutLabelColon
@@ -145,7 +145,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
145145
<Modal
146146
className={styles.modal}
147147
heading={typeDisplay}
148-
headerDescription="Readiness Information by National Society"
148+
headerDescription={strings.eruReadinessInformationHeading}
149149
onClose={setShowReadinessInfoFalse}
150150
withHeaderBorder
151151
size="md"
@@ -165,7 +165,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
165165
>
166166
<TextOutput
167167
className={styles.readiness}
168-
label="Equipment Readiness"
168+
label={strings.eruEquipmentReadiness}
169169
value={(
170170
<CheckboxCircleLineIcon
171171
className={getReadinessColor(readiness.equipment_readiness)}
@@ -177,7 +177,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
177177
<div className={styles.separatorLeft} />
178178
<TextOutput
179179
className={styles.readiness}
180-
label="People Readiness"
180+
label={strings.eruPeopleReadiness}
181181
value={(
182182
<CheckboxCircleLineIcon
183183
className={getReadinessColor(readiness.people_readiness)}
@@ -189,7 +189,7 @@ function EmergencyResponseUnitTypeCard(props: Props) {
189189
<div className={styles.separatorLeft} />
190190
<TextOutput
191191
className={styles.readiness}
192-
label="Funding Readiness"
192+
label={strings.eruFundingReadiness}
193193
value={(
194194
<CheckboxCircleLineIcon
195195
className={getReadinessColor(readiness.funding_readiness)}
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{
22
"namespace": "surgeOverview",
33
"strings": {
4-
"emergencyResponseUnitOwnerCardLastUpdated": "Last updated",
5-
"emergencyResponseUnitOwnerCardReady": "{count} Ready ERUs",
6-
"emergencyResponseUnitOwnerCardDeployed": "{count} Deployed ERUs"
4+
"emergencyResponseUnitOwnerNSCardLastUpdated": "Last updated",
5+
"emergencyResponseUnitOwnerNSCardReady": "{count} Ready ERUs",
6+
"emergencyResponseUnitOwnerNSCardDeployed": "{count} Deployed ERUs",
7+
"eruNSSeeReadinessInfoButton": "See readiness info",
8+
"eruTypesLabel": "ERU Type(s)",
9+
"eruNSEquipmentReadiness": "Equipment Readiness",
10+
"eruNSPeopleReadiness": "People Readiness",
11+
"eruNSFundingReadiness": "Funding Readiness",
12+
"eruNSReadinessInformationHeading": "Readiness Information by ERU Type"
713
}
814
}

app/src/views/SurgeOverview/EmergencyResponseUnit/EmergencyResponseUnitReadiness/NationalSocietyCard/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function NationalSocietyTypeCard(props: Props) {
6060
headerDescription={(
6161
<TextOutput
6262
className={styles.lastUpdated}
63-
label={strings.emergencyResponseUnitOwnerCardLastUpdated}
63+
label={strings.emergencyResponseUnitOwnerNSCardLastUpdated}
6464
value={eruData.updated_at}
6565
valueType="date"
6666
/>
@@ -70,14 +70,14 @@ function NationalSocietyTypeCard(props: Props) {
7070
name={undefined}
7171
onClick={setShowReadinessInfoTrue}
7272
variant="tertiary"
73-
title="Show Readiness Information"
73+
title={strings.eruNSSeeReadinessInfoButton}
7474
>
75-
Show Readiness Information
75+
{strings.eruNSSeeReadinessInfoButton}
7676
</Button>
7777
)}
7878
>
7979
<TextOutput
80-
label="ERU Type(s)"
80+
label={strings.eruTypesLabel}
8181
value={eruTypes}
8282
strongValue
8383
withoutLabelColon
@@ -88,7 +88,7 @@ function NationalSocietyTypeCard(props: Props) {
8888
heading={
8989
eruData.eru_owner_details.national_society_country_details.society_name
9090
}
91-
headerDescription="Readiness Information by ERU Type"
91+
headerDescription={strings.eruNSReadinessInformationHeading}
9292
onClose={setShowReadinessInfoFalse}
9393
withHeaderBorder
9494
size="md"
@@ -106,7 +106,7 @@ function NationalSocietyTypeCard(props: Props) {
106106
>
107107
<TextOutput
108108
className={styles.readiness}
109-
label="Equipment Readiness"
109+
label={strings.eruNSEquipmentReadiness}
110110
value={(
111111
<CheckboxCircleLineIcon
112112
className={getReadinessColor(eruType.equipment_readiness)}
@@ -118,7 +118,7 @@ function NationalSocietyTypeCard(props: Props) {
118118
<div className={styles.separatorLeft} />
119119
<TextOutput
120120
className={styles.readiness}
121-
label="People Readiness"
121+
label={strings.eruNSPeopleReadiness}
122122
value={(
123123
<CheckboxCircleLineIcon
124124
className={getReadinessColor(eruType.people_readiness)}
@@ -130,7 +130,7 @@ function NationalSocietyTypeCard(props: Props) {
130130
<div className={styles.separatorLeft} />
131131
<TextOutput
132132
className={styles.readiness}
133-
label="Funding EruType"
133+
label={strings.eruNSFundingReadiness}
134134
value={(
135135
<CheckboxCircleLineIcon
136136
className={getReadinessColor(eruType.funding_readiness)}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"namespace": "surgeOverview",
3+
"strings": {
4+
"eruReadinessCount": "ERU Capacity and Readiness ({count})",
5+
"eruReadinessUpdateButton": "Update ERU Readiness",
6+
"eruNationalSociety": "National Society",
7+
"eruType": "ERU Type"
8+
}
9+
}

app/src/views/SurgeOverview/EmergencyResponseUnit/EmergencyResponseUnitReadiness/index.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ import {
1212
TabPanel,
1313
Tabs,
1414
} from '@ifrc-go/ui';
15+
import { useTranslation } from '@ifrc-go/ui/hooks';
1516
import {
1617
maxSafe,
1718
minSafe,
1819
numericIdSelector,
20+
resolveToString,
1921
stringKeySelector,
2022
} from '@ifrc-go/ui/utils';
2123
import {
2224
isDefined,
2325
listToGroupList,
2426
mapToList,
27+
unique,
2528
} from '@togglecorp/fujs';
2629

2730
import Link from '#components/Link';
@@ -36,6 +39,8 @@ import {
3639
import EmergencyResponseUnitCard, { type ReadinessList } from './EmergencyResponseUnitCard';
3740
import NationalSocietyCard from './NationalSocietyCard';
3841

42+
import i18n from './i18n.json';
43+
3944
type EruReadinessResponse = GoApiResponse<'/api/v2/eru-readiness/'>;
4045
type GlobalEnumsResponse = GoApiResponse<'/api/v2/global-enums/'>;
4146
type EruOwners = GoApiResponse<'/api/v2/eru_owner/mini/'>;
@@ -53,14 +58,15 @@ const emergencyResponseUnitTypeKeySelector = (item: EruTypeOption) => item.key;
5358
const emergencyResponseUnitTypeLabelSelector = (item: EruTypeOption) => item.value ?? '?';
5459

5560
function EmergencyResponseUnitReadiness() {
61+
const strings = useTranslation(i18n);
5662
const {
5763
rawFilter,
5864
filtered,
5965
filter,
6066
setFilterField,
6167
} = useFilterState<{
62-
selectEruTypes? : EruTypeOption['key'],
63-
selectEruOwner? : EruOwnerOption['id'],
68+
selectEruTypes? : number,
69+
selectEruOwner? : number,
6470
}>({
6571
filter: {},
6672
});
@@ -119,11 +125,11 @@ function EmergencyResponseUnitReadiness() {
119125
readinessList: ReadinessList;
120126
}) => ({
121127
typeDisplay: item.readinessList[0].type_display,
122-
nationalSocieties: joinStrings(
128+
nationalSocieties: joinStrings(unique(
123129
item.readinessList.map((v) => (
124130
v.eruOwner.national_society_country_details.society_name
125131
)).filter(isDefined),
126-
),
132+
)),
127133
fundingReadiness: minSafe(item.readinessList.map((v) => v.funding_readiness)),
128134
equipmentReadiness: minSafe(item.readinessList.map((v) => v.equipment_readiness)),
129135
peopleReadiness: minSafe(item.readinessList.map((v) => v.people_readiness)),
@@ -142,22 +148,25 @@ function EmergencyResponseUnitReadiness() {
142148
variant="tertiary"
143149
>
144150
<Container
145-
heading={`ERU Capacity and Readiness (${eruReadinessResponse?.count})`}
151+
heading={resolveToString(
152+
strings.eruReadinessCount,
153+
{ count: eruReadinessResponse?.count },
154+
)}
146155
withHeaderBorder
147156
actions={(
148157
<Link
149158
to="eruReadinessForm"
150159
variant="primary"
151160
>
152-
Update ERU Readiness
161+
{strings.eruReadinessUpdateButton}
153162
</Link>
154163
)}
155164
contentViewType="vertical"
156165
filters={(
157166
<>
158167

159168
<SelectInput
160-
placeholder="National Society"
169+
placeholder={strings.eruNationalSociety}
161170
name="selectEruOwner"
162171
options={eruOwnersResponse?.results}
163172
onChange={setFilterField}
@@ -168,7 +177,7 @@ function EmergencyResponseUnitReadiness() {
168177
disabled={eruOwnersPending}
169178
/>
170179
<SelectInput
171-
placeholder="ERU Type"
180+
placeholder={strings.eruType}
172181
name="selectEruTypes"
173182
value={rawFilter.selectEruTypes}
174183
onChange={setFilterField}
@@ -180,8 +189,8 @@ function EmergencyResponseUnitReadiness() {
180189
)}
181190
filterActions={(
182191
<TabList>
183-
<Tab name="eruType">ERU Type</Tab>
184-
<Tab name="nationalSociety">National Society</Tab>
192+
<Tab name="eruType">{strings.eruType}</Tab>
193+
<Tab name="nationalSociety">{strings.eruNationalSociety}</Tab>
185194
</TabList>
186195
)}
187196
>

0 commit comments

Comments
 (0)