LG-6026: Telephone input country listing is not translated#6336
LG-6026: Telephone input country listing is not translated#6336
Conversation
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
96c73f6 to
0439b0a
Compare
0439b0a to
34eaa61
Compare
| /** @type {string[]} */ | ||
| deliveryMethods = []; | ||
|
|
||
| /** @type {Object.<string,*>} */ |
There was a problem hiding this comment.
It looks to me like it works in practice, though my understanding is that it's recommended to avoid the uppercase "Object" type (along with a few others). Also, would we be safe to assume that the expected value should be a string?
Maybe one of these:
| /** @type {Object.<string,*>} */ | |
| /** @type {Record<string, string>} */ |
| /** @type {Object.<string,*>} */ | |
| /** @type {object} */ |
The latter comes from the DefinitelyTyped types for the library, in case we want to align to that, and optionally add it as a devDependency to our project.
|
|
||
| try { | ||
| this.deliveryMethods = JSON.parse(this.dataset.deliveryMethods || ''); | ||
| this.countryCodePairs = JSON.parse(this.dataset.translatedCountryCodeNames || ''); |
There was a problem hiding this comment.
Not that I would expect it to fail, but one downside of grouping these assignments in the same try block is that if deliveryMethods fails to parse, we won't assign countryCodePairs, even if countryCodePairs could be parsed.
To me, it seems like either we should trust that they'd always parse correctly and avoid the try blocks altogether, or if we want to be guarded about it, we should have two separate try blocks, one for each.
| this.countryCodePairs = JSON.parse(this.dataset.translatedCountryCodeNames || ''); | |
| } catch {} | |
| try { | |
| this.countryCodePairs = JSON.parse(this.dataset.translatedCountryCodeNames || ''); |
changelog: Improvements, Phone Input, Show translated text labels for phone dropdowns
No description provided.