-
Notifications
You must be signed in to change notification settings - Fork 77
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
feat(i18n): stub public-facing locales #7288
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Identify common error messages that a member of the public might see in a form page, and place them in a locale specifically for that. TODO - Move some of the validation messages in common over to this
01e47a5
to
70ed6f3
Compare
karrui
previously requested changes
May 10, 2024
70ed6f3
to
f639e5e
Compare
- Replace hard-coded text in PublicFormProvider and related components with i18next equivalents - Default server error messages to i18next keys, and in PublicFormProvider, attempt to use them as such. If they are not, use the response messages as-is.
Allow translations to be optional, so that development is not held back by waiting for translations. Previously, these were required, so either the team waits for translated text, or is forced to use placeholders. This either slows the team down, or litters the codebase with unhelpful locale text to be laboriously translated later. - Allow features within Translation locales to be optional - Extend Translation to FallbackTranslation, which still makes them mandatory - Declare en-sg as a FallbackTranslation - Trim zh-sg to only have `login` translations, removing all other placeholder text
f639e5e
to
ee393b1
Compare
KenLSM
approved these changes
May 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Merging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
As part of efforts to make it easier to localize FormSG, we are prioritising the public-facing elements of the frontend.
Solution
with i18next equivalents.
Dropped
The following was initially proposed but subsequently dropped:
PublicFormProvider, attempt to use them as such. If they are not,
use the response messages as-is.
This will be addressed in later development work.
Additional work
On request, i18next locales were refactored to be optional, so that
placeholders are no longer needed. en-sg was made mandatory,
since it is a fallback language
mandatory
login
translations, removing all otherplaceholder text
Considerations
Even if the frontend and some parts of the backend now refers to our i18next keys,
form.server.model
defaultsthe inactive message to a hard-coded string. Replacing the default with an i18next key is awkward, as the value
will be shown as-is to the form admin, who may be unaware of what we are trying to do.