Skip to content

Commit 323102d

Browse files
committed
copy-i18n-tags: Add clarifying comments to categoryRegexPrefix
1 parent e4fc74b commit 323102d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/copy-i18n-tags.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ for (const localeFile of localeFiles) {
7676
const localeCategory = localeTranslations[enCategoryName] || {};
7777

7878
// Prefix for regular expressions that require the pattern to exist within a category. This depends on
79-
// categories and their tags to not contain new lines and categories being separated by a newline
79+
// categories and their tags to not contain new lines and categories being separated by a newline. This regex
80+
// is intended to be used as a prefix for regular expressions looking for a specific tag. It is used to
81+
// make sure the tag belongs to the current category. It does so by ensuring that there is a category name
82+
// in the locale file, followed by one or more non empty lines. You can then append any tag specififc regex
83+
// to this expression to obtain a regular expression that pattern matches a specific tag within a category.
8084
const categoryRegexPrefix = `\\s\\s${escapeRegexp(enCategoryName)}:\\n(?:.+\\n)*`;
8185

8286
rewrittenLines.push('');

0 commit comments

Comments
 (0)