Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emit diagnostic when a key contains different parameters than its value #59

Open
earloc opened this issue Dec 27, 2022 · 0 comments
Open
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed storage:resx

Comments

@earloc
Copy link
Owner

earloc commented Dec 27, 2022

As a developer, I want to get notified when e resource-key contains more or less parameters than a value of one of the localized resources, in order to prevent runtime-errors after modifying translations.

example1 - too few parameters

the following content of a resx-file should produce a diagnostic The resource-key 'Hello {user:s}, it is {today:d}' of resource 'SomeResource.resx' specifies 1 parameter(s) more, than it´s current value.

//SomeResource.resx

<data name="Hello {user:s}, it is {today:d}" xml:space="preserve">
 	<value>Hello {0}</value>
 </data>

example2 - too many parameters

the following content of a resx-file should produce a diagnostic The resource-key 'Hello {user:s}' of resource 'SomeResource.de-DE.resx' specifies 1 parameter(s) less, than it´s current value.

//SomeResource.de-DE.resx

<data name="Hello {user:s}}" xml:space="preserve">
 	<value>Hello {0}, today is {1}</value>
 </data>

example3 - parameters type mismatch in format-string

the following content of a resx-file should produce a diagnostic The parameter ' {user:s}' of resource-key 'Hello {user:s}, it is {today:d}' of resource 'SomeResource.en-US.resx' is being formatted with an incompatible format '{0:yyyyDDmm}' .

//SomeResource.en-US.resx

<data name="Hello Hello {user:s}, it is {today:d}" xml:space="preserve">
 	<value>Hello '{0:yyyyDDmm}, today is {1}</value>
 </data>

All of the above samples should emit a designated diagnostic TR-XXXX with appropriate explanations

@earloc earloc added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Dec 27, 2022
@earloc earloc changed the title emit diagnostic when a key contains different number of parameters than the default-value emit diagnostic when a key contains different parameters than its value Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed storage:resx
Projects
None yet
Development

No branches or pull requests

1 participant