diff --git a/packages/theme-check-common/src/checks/matching-translations/index.spec.ts b/packages/theme-check-common/src/checks/matching-translations/index.spec.ts index 06f04313b..070df312f 100644 --- a/packages/theme-check-common/src/checks/matching-translations/index.spec.ts +++ b/packages/theme-check-common/src/checks/matching-translations/index.spec.ts @@ -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' }), diff --git a/packages/theme-check-common/src/checks/matching-translations/index.ts b/packages/theme-check-common/src/checks/matching-translations/index.ts index b43054fe1..707bfbf31 100644 --- a/packages/theme-check-common/src/checks/matching-translations/index.ts +++ b/packages/theme-check-common/src/checks/matching-translations/index.ts @@ -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;