Skip to content

Commit 9c775b4

Browse files
author
MargeBot
committed
Merge branch 'chore/add-empty-context-detection' into 'main'
Add empty context detection in i18n:validate job See merge request web/clients!25664
2 parents ae1ed2c + 7999ce8 commit 9c775b4

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

packages/activation/src/components/Modals/ProductSelectionModal/ProductItem.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import { IcUsers } from '@proton/icons/icons/IcUsers';
99

1010
const productMap = {
1111
[ImportType.MAIL]: {
12-
getLabel: () => c('').t`Emails`,
12+
getLabel: () => c('Label').t`Emails`,
1313
icon: <IcEnvelope className="shrink-0" />,
1414
},
1515
[ImportType.CALENDAR]: {
16-
getLabel: () => c('').t`Calendars`,
16+
getLabel: () => c('Label').t`Calendars`,
1717
icon: <IcCalendarGrid className="shrink-0" />,
1818
},
1919
[ImportType.CONTACTS]: {
20-
getLabel: () => c('').t`Contacts`,
20+
getLabel: () => c('Label').t`Contacts`,
2121
icon: <IcUsers className="shrink-0" />,
2222
},
2323
};

packages/activation/src/oles/components/MigrationSetup/StepFinal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ const StepFinal: FC<StepComponentProps> = ({ model: migrationConfiguration }) =>
119119
{c('BOSS')
120120
.t`You're almost done, you need to configure your domain to receive your emails directly on ${BRAND_NAME}. Once confirmed, your team will stop receiving new emails on Gmail and the migration will be completed.`}
121121
</p>
122-
<LazyLottie style={{ padding: '0 10rem' }} autoPlay getAnimationData={() => import('../../animations/providerSwitch.json')} loop={true} />
122+
<LazyLottie
123+
style={{ padding: '0 10rem' }}
124+
autoPlay
125+
getAnimationData={() => import('../../animations/providerSwitch.json')}
126+
loop={true}
127+
/>
123128
<p className="color-weak">{c('BOSS')
124129
.t`Copy the below code and paste it in the DNS section of your domain host.`}</p>
125130
<DNSGroupRecords group={group} />
@@ -131,7 +136,7 @@ const StepFinal: FC<StepComponentProps> = ({ model: migrationConfiguration }) =>
131136
>
132137
<div className="px-2">
133138
<p className="m-0">{c('Label').t`Confirm MX records added`}</p>
134-
<span className="color-weak text-sm">{c('').t`Required to proceed to the next step`}</span>
139+
<span className="color-weak text-sm">{c('Info').t`Required to proceed to the next step`}</span>
135140
</div>
136141
</Checkbox>
137142
</div>

packages/i18n/scripts/linter.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ async function* errorIterator(source = 'src', options = { isVerbose: false }) {
132132
if (errorsNumbers.match) {
133133
yield* errorsNumbers.errors(file);
134134
}
135+
136+
// Matches an empty (or whitespace-only) context: c(''), c(""), c(``)
137+
const errorEmptyContext = testRule(
138+
/c\(\s*(?:\x27\s*\x27|\x22\s*\x22|\x60\s*\x60)\s*\)\./g,
139+
content,
140+
'emptyContext'
141+
);
142+
if (errorEmptyContext.match) {
143+
yield* errorEmptyContext.errors(file);
144+
}
135145
}
136146
}
137147

@@ -181,6 +191,15 @@ function formatErrors(error) {
181191
`;
182192
}
183193

194+
if (error.type === 'emptyContext') {
195+
return `🚨 [Error] ${error.file}:${error.index}
196+
match: ${error.match}
197+
line: ${error.line}
198+
fix: The translation context must not be empty.
199+
Use a meaningful context - c(\x27<context>\x27).t\`<string>\`
200+
`;
201+
}
202+
184203
if (error.type === 'numbers') {
185204
return `🚨 [Error] ${error.file}:${error.index}
186205
match: ${error.match}

0 commit comments

Comments
 (0)