Skip to content

Commit

Permalink
[i18n] [8.16] Integrate 8.16.0 Translations (#199151)
Browse files Browse the repository at this point in the history
Integrating latest translations extracted from 8.16 branch.
Skipping backports from main to target branches since the `i18n_check`
might trim unused translations that are still used in different
branches. Integration script is ran against each target branch
separately.
  • Loading branch information
Bamieh authored Nov 7, 2024
1 parent e63d4ec commit af3ddd0
Show file tree
Hide file tree
Showing 5 changed files with 11,618 additions and 2,409 deletions.
2 changes: 1 addition & 1 deletion src/dev/i18n_tools/bin/run_i18n_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ run(
},
{
title: 'Checking Untracked i18n Messages outside defined namespaces',
enabled: (_) => !ignoreUntracked || !!(filterNamespaces && filterNamespaces.length),
enabled: (_) => !ignoreUntracked && !!(filterNamespaces && filterNamespaces.length),
task: (context, task) => checkUntrackedNamespacesTask(context, task, { rootPaths }),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,31 @@ const removeOutdatedMessages = (
'outdatedMessages' | 'updatedMessages',
Array<[string, string | { message: string }]>
> => {
const outdatedMessages: Array<[string, string | { message: string }]> = [];
let updatedMessages = translationMessages;
return translationMessages.reduce(
(acc, [translatedId, translatedMessage]) => {
const messageDescriptor = extractedMessages.find(({ id }) => id === translatedId);
// removed from codebase
if (!messageDescriptor) {
acc.outdatedMessages.push([translatedId, translatedMessage]);
return acc;
}

updatedMessages = translationMessages.filter(([translatedId, translatedMessage]) => {
const messageDescriptor = extractedMessages.find(({ id }) => id === translatedId);
if (!messageDescriptor?.hasValuesObject) {
return true;
}
try {
verifyMessageDescriptor(
typeof translatedMessage === 'string' ? translatedMessage : translatedMessage.message,
messageDescriptor
);
return true;
} catch (err) {
outdatedMessages.push([translatedId, translatedMessage]);
// failed to verify message against latest descriptor. remove from file.
return false;
}
});
try {
verifyMessageDescriptor(
typeof translatedMessage === 'string' ? translatedMessage : translatedMessage.message,
messageDescriptor
);
acc.updatedMessages.push([translatedId, translatedMessage]);
} catch (err) {
// failed to verify message against latest descriptor. remove from file.
acc.outdatedMessages.push([translatedId, translatedMessage]);
}

return { updatedMessages, outdatedMessages };
return acc;
},
{ updatedMessages: [], outdatedMessages: [] } as Record<
'outdatedMessages' | 'updatedMessages',
Array<[string, string | { message: string }]>
>
);
};
Loading

0 comments on commit af3ddd0

Please sign in to comment.