Fix unused resource strings and hardcoded template names in metadata.json files #1704
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
This PR addresses two related issues in the Azure Functions Templates repository:
Resources.resxthat were not being used anywhere in the codebasemetadata.jsonfiles had hardcoded template names instead of using resource references, unlike thedescriptionfield which properly used resource referencesExample of the Issue
Before this fix, templates had an inconsistent pattern:
{ "defaultFunctionName": "BlobTrigger", "description": "$BlobTrigger_description", "name": "Azure Blob Storage trigger", "language": "Python" }The
descriptionfield properly references a resource string ($BlobTrigger_description), but thenamefield uses a hardcoded string. This makes localization difficult and creates maintenance challenges.Solution
1. Enhanced CheckResourceStrings Tool
Updated the existing tool to detect unused resource strings:
metadata.jsonfiles directly (not just compiledtemplates.json)Resources.resxdirectlyProgram.UnusedStrings.cspartial class with helper methodsUsage:
2. Added New Resource Strings
Added 34 new resource string entries to
Resources.resxfor template names that didn't have resource references:AzureBlobStorageTrigger_nameAzureCosmosDbTrigger_nameAzureEventGridTrigger_nameDurableFunctionsHttpStarter_nameKafkaTrigger_nameSqlInputBinding_name3. Updated All Template Metadata Files
Updated all 201
metadata.jsonfiles to use resource references for thenamefield:{ "defaultFunctionName": "BlobTrigger", "description": "$BlobTrigger_description", "name": "$AzureBlobStorageTrigger_name", "language": "Python" }Templates updated span all supported languages (C#, F#, JavaScript, TypeScript, Python, PowerShell) and all template types (triggers, bindings, Durable Functions, etc.).
Impact
nameanddescriptionfieldsResources.resxMetrics
Testing Recommendations
Resources.*.jsonfilesDocumentation
Docs/UnusedResourceStringsAnalysis.md: Comprehensive analysis of the issue and implementation approachDocs/CHANGELIST.md: Detailed list of all changes, impact analysis, and migration guide for future template additionsRelated Issue
Fixes issue about unused strings in Resources.resx and hardcoded template names in metadata
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.