Migrate post survey messages out of serverless assets#4000
Migrate post survey messages out of serverless assets#4000stephenhand merged 7 commits intomasterfrom
Conversation
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
stephenhand
left a comment
There was a problem hiding this comment.
You still need to migrate the postSurveyMessages.json files other than es.json and en-US.json files into the customStrings folder for the form definition where the second part of the containing folder in serverless assets is the same as the first part of the name for the folder for the form definition set
For example en-JM goes into the customStrings in jm-v1
…ition customStrings Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Done in commit 860984a. Migrated all remaining
The |
There was a problem hiding this comment.
This translation lookup will be used in places other than post surveys, give it a more generic name and move it to the translations directory
There was a problem hiding this comment.
Done in commit fb655bf. Renamed postSurveyTranslationLookup.ts → translationLookup.ts and moved it to src/translations/. Also renamed the exported types/functions to be generic (PostSurveyMessages → TranslationMessages, getPostSurveyTranslation → getTranslation). The test file was moved to tests/unit/translations/translationLookup.test.ts accordingly.
…slations/translationLookup Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Fixed in commit 66bf19e. Collapsed multi-line |
…ages' into copilot/migrate-post-survey-messages
Post survey trigger messages were fetched at runtime from the serverless repo via HTTP. This migrates all those translations into this repo and replaces the HTTP fetch with a local lookup chain.
Description
Translation file structure
lambdas/account-scoped/src/translations/en.json— global English default (from serverlessen-US/postSurveyMessages.json)lambdas/account-scoped/src/translations/es.json— global Spanish (from serverlesses/postSurveyMessages.json)form-definitions/{helpline}/v1/customStrings/postSurveyMessages.json— helpline-specific overrides migrated from serverless locale folders where the second part of the locale matches the helpline code:en-JM→jm/v1/customStrings/postSurveyMessages.jsonen-NZ→nz/v1/customStrings/postSurveyMessages.jsonen-USCH→usch/v1/customStrings/postSurveyMessages.json(pre-existing, same content)en-USCR→uscr/v1/customStrings/postSurveyMessages.jsonen-ZA→za/v1/customStrings/postSurveyMessages.jsones-CL→cl/v1/customStrings/postSurveyMessages.jsones-CLHS→clhs/v1/customStrings/postSurveyMessages.json(pre-existing, same content)es-CO→co/v1/customStrings/postSurveyMessages.jsonpt-BR→br/v1/customStrings/postSurveyMessages.jsonLookup logic (
translations/translationLookup.ts)Priority chain for a given key +
taskLanguage:customStrings.postSurveyMessages[key]from helpline's form definitionstranslations/{taskLanguage}.json(e.g.en-US.json)translations/{language}.json(e.g.en.json)translations/en.json(hardcoded global default)Locale chain deduplicates (e.g.
taskLanguage=en→ only triesenonce).Other changes
DefinitionVersion.customStringsgainspostSurveyMessages: Record<string, string>field;loadDefinitionfetchescustomStrings/postSurveyMessages.jsonwith{}as defaultpostSurveyListener.tsdropsserverlessBaseUrl/getServerlessBaseUrlentirely; callsgetTranslation(accountSid, taskLanguage, 'triggerMessage')insteadsrc/translations/translationLookup.tswith generic exports (TranslationMessages,getTranslation) so it can be reused beyond post surveystests/unit/translations/translationLookup.test.ts)Checklist
Other Related Issues
None
Verification steps
enable_post_survey: truecustomStrings/postSurveyMessages.json(e.g.usch,jm,nz), verify the helpline-specific message takes priorityes-CO), verify thecocustomStrings entry is useden.jsonglobal default is usedAFTER YOU MERGE
You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.