Make phone number validation and UI translatable (#344) - #363
Open
nonprofittechy wants to merge 1 commit into
Open
Make phone number validation and UI translatable (#344)#363nonprofittechy wants to merge 1 commit into
nonprofittechy wants to merge 1 commit into
Conversation
#344) - Make PhoneNumber custom data type validation message translatable via window.alTranslate - Provide localized country names and UI labels for intl-tel-input via Intl.DisplayNames and al_translate.js - Re-initialize phone inputs upon receiving the alTranslationsLoaded event - Add phone validation strings to ALTOOLBOX_JS_STRINGS and provide translations in altoolbox_words.yml - Update test_translation_strings.py to assert phone validation string coverage
This file contains hidden or 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
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.
Description
This PR resolves #344 by adding internationalization and translation support to the
PhoneNumbercustom data type andphone-number-validation.js(intl-tel-inputwidget).Changes
PhoneNumberDataType.py: The default validation message is now routed throughwindow.alTranslate()when available (with fallback to the English string and preservingdata-alInvalidInputMessageoverride).phone-number-validation.js:alTranslate.Intl.DisplayNamesto populate localized country names dynamically based on the active language.alTranslationsLoadedto re-initialize and translate existing inputs once translations finish loading.translation_strings.py&altoolbox_words.yml:ALTOOLBOX_JS_STRINGS.altoolbox_words.ymlforar,es,fr,ht,km,pt,vi,zh-Hans,zh-CN,zh-Hant,zh-TW, andne.test_translation_strings.py.phone-number-validation.ymlexample question to load translation modules.Closes #344.
Testing
pytest: 78 passed).mypy: 0 issues).black).