From a151b2abfdad3be8962db7a205e68d09190dbd5a Mon Sep 17 00:00:00 2001 From: Jesse Zhu Date: Mon, 6 May 2024 01:18:08 +0800 Subject: [PATCH] Fix next-intl's function name --- src/frameworks/next-intl.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/frameworks/next-intl.ts b/src/frameworks/next-intl.ts index 5a628545..0924928f 100644 --- a/src/frameworks/next-intl.ts +++ b/src/frameworks/next-intl.ts @@ -1,7 +1,8 @@ import { TextDocument } from 'vscode' -import { Framework, ScopeRange } from './base' +import { KeyStyle, RewriteKeyContext, RewriteKeySource } from '~/core' import { LanguageId } from '~/utils' -import { RewriteKeySource, RewriteKeyContext, KeyStyle } from '~/core' + +import { Framework, ScopeRange } from './base' class NextIntlFramework extends Framework { id = 'next-intl' @@ -79,10 +80,10 @@ class NextIntlFramework extends Framework { const ranges: ScopeRange[] = [] const text = document.getText() - // Find matches of `useTranslations` and `getTranslator`. Later occurences will + // Find matches of `useTranslations` and `getTranslations`. Later occurences will // override previous ones (this allows for multiple components with different // namespaces in the same file). - const regex = /(useTranslations\(\s*|getTranslator\(.*,\s*)(['"`](.*?)['"`])?/g + const regex = /(useTranslations\(\s*|getTranslations\(\s*)(['"`](.*?)['"`])?/g let prevGlobalScope = false for (const match of text.matchAll(regex)) { if (typeof match.index !== 'number')