Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,36 @@ describe('Module: MatchingTranslations', async () => {
}
});

it('should not report offenses and ignore Shopify keys for Accounts (New)', async () => {
for (const prefix of ['', '.schema']) {
const theme = {
[`locales/en.default${prefix}.json`]: JSON.stringify({
hello: 'Hello',
customer_accounts: {
account_information: {
title: 'Account',
}
}
}),
[`locales/pt-BR${prefix}.json`]: JSON.stringify({
hello: 'Olá',
customer_accounts: {
navigation_and_structure: {
account_menu: {
label: 'Compte',
}
}
}
}),
};

const offenses = await check(theme, [MatchingTranslations]);
console.log(offenses);

expect(offenses).to.be.of.length(0);
}
});

it('should not report offenses and ignore "*.schema.json" files', async () => {
const theme = {
'locales/en.default.json': JSON.stringify({ hello: 'Hello' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const MatchingTranslations: JSONCheckDefinition = {
const hasDefaultTranslations = () => defaultTranslations.size > 0;
const isTerminalNode = ({ type }: JSONNode) => type === 'Literal';
const isPluralizationNode = (node: PropertyNode) => PLURALIZATION_KEYS.has(node.key.value);
const isShopifyPath = (path: string) => path.startsWith('shopify.');
const isShopifyPath = (path: string) => path.startsWith('shopify.') || path.startsWith('customer_accounts.');

const hasDefaultTranslation = (translationPath: string) =>
defaultTranslations.has(translationPath) ?? false;
Expand Down