Class StringResourceReferencePatterns
- Namespace
- GroupeIsa.Neos.Shared.Localization
- Assembly
- GroupeIsa.Neos.Shared.dll
Provides the regex patterns and access-class prefixes used to locate string resource references in client C# code and UI templates. Shared between the generator's reference validation and the designer's find-usages/rename feature.
public static class StringResourceReferencePatterns
- Inheritance
-
StringResourceReferencePatterns
- Inherited Members
Fields
ApplicationPrefix
The access-class prefix for application-layer resources.
public const string ApplicationPrefix = "AppResources"
Field Value
CodeReferencePattern
Pattern matching a resource reference in C# code. Group 1 captures "Prefix.Module.Name".
public const string CodeReferencePattern = "((?<![A-Za-z0-9_.])(?:Resources|AppResources|UIResources)\\.(?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))"
Field Value
DomainPrefix
The access-class prefix for domain-layer resources.
public const string DomainPrefix = "Resources"
Field Value
FrontendPrefix
The access-class prefix for frontend-scoped resources.
public const string FrontendPrefix = "UIResources"
Field Value
TemplateReferencePattern
Pattern matching a resource reference in a UI template. Group 1 captures "Module.Name".
public const string TemplateReferencePattern = "\\@Resources\\.((?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))"
Field Value
Methods
CreateCodeReferenceRegex()
[GeneratedRegex("((?<![A-Za-z0-9_.])(?:Resources|AppResources|UIResources)\\.(?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))")]
public static Regex CreateCodeReferenceRegex()
Returns
Remarks
Pattern:
((?<![A-Za-z0-9_.])(?:Resources|AppResources|UIResources)\\.(?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))Explanation:<br />
<pre><code class="lang-csharp">○ 1st capture group.
○ Zero-width negative lookbehind.
○ Match a character in the set [.0-9A-Z_a-z] right-to-left.
○ Match with 3 alternative expressions.
○ Match the string "Resources".
○ Match the string "AppResources".
○ Match the string "UIResources".
○ Match '.'.
○ Match a character in the set [A-Z_a-z].
○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.
○ Match '.'.
○ Match a character in the set [A-Z_a-z].
○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.</code></pre>
CreateTemplateReferenceRegex()
[GeneratedRegex("\\@Resources\\.((?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))")]
public static Regex CreateTemplateReferenceRegex()
Returns
Remarks
Pattern:
\\@Resources\\.((?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))Explanation:<br />
<pre><code class="lang-csharp">○ Match the string "@Resources.".
○ 1st capture group. ○ Match a character in the set [A-Z_a-z]. ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times. ○ Match '.'. ○ Match a character in the set [A-Z_a-z]. ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.