-
Notifications
You must be signed in to change notification settings - Fork 199
[Feature] Add l10n support to CheckoutUiExtension #2009
Conversation
4de0d27
to
f1338d9
Compare
f1338d9
to
a03df68
Compare
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.
Nice work, @ginmrt ✨
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Show resolved
Hide resolved
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
test/project_types/extension/models/specification_handlers/checkout_ui_extension_test.rb
Show resolved
Hide resolved
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.
Left some early feedback. Looks fine overall. I still need to tophat.
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Show resolved
Hide resolved
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
a03df68
to
88d6e2b
Compare
@ginmrt do you mind rebasing this PR onto latest |
bccaa1d
to
e961448
Compare
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.
I 🎩'd with a handpicked list of test scenarios and they all checked out for me. Great work Martin.
There is one additional fix that I am requesting before merge though. Once that is addressed, then I can approve.
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
e961448
to
c936b9e
Compare
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.
I still have open feedback that should be given consideration. But overall, I've seen enough from this PR to approve.
c936b9e
to
a189992
Compare
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.
I've added a few suggestions, but the only important one would be to extract the error messages. Otherwise, the code and tests look great (I haven't tested it, as it was done before) 👌
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Show resolved
Hide resolved
lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb
Outdated
Show resolved
Hide resolved
test/project_types/extension/models/specification_handlers/checkout_ui_extension_test.rb
Outdated
Show resolved
Hide resolved
a189992
to
bcdae00
Compare
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.
Thanks for the changes! It looks great 👍
WHY are these changes introduced?
Fixes internal issue
WHAT is this pull request doing?
As part of the Localized Checkout Ui Extensions project, we must update the
shopify-cli
codebase to allow developers to submit localization files along with their code updates when the Shopify CLIshopify extension push
command is executed.This change applies to the Checkout Extension type of extensions only, for now.
Screenshots
Valid submission
This will be what is shown in the CLI when we will have merged in the code in the Shopify backend that will support this new localization feature.
![Screen Shot 2022-02-03 at 11 16 08 AM](https://user-images.githubusercontent.com/3000613/152386108-0e35b55e-8ac5-4bf7-b809-750ddeb426a2.png)
Valid submission with unrecognized key warning
This will be what is shown in the CLI before and until we will have merged in the code in the Shopify backend that will support this new localization feature.
![Screen Shot 2022-02-03 at 11 15 42 AM](https://user-images.githubusercontent.com/3000613/152386412-fd4bfb01-4690-434e-9ae1-c7472fbc6988.png)
Note that attempting to publish an extension with this data pushed in before support has been added will fail.
![Screen Shot 2022-02-03 at 10 41 04 AM](https://user-images.githubusercontent.com/3000613/152386377-3dc473b0-0c9a-4fc0-ba26-c166f5f169ac.png)
Invalid submission: Invalid locale code
This error appears if the locale code of a given file name is invalid.
![Screen Shot 2022-02-07 at 4 25 42 PM](https://user-images.githubusercontent.com/3000613/152874601-ba8fa3b5-cb37-4f0a-a169-e82ad76cb2f2.png)
Invalid submission: Invalid file extension
This error appears if a file under the
![Screen Shot 2022-02-03 at 11 08 52 AM](https://user-images.githubusercontent.com/3000613/152386939-8166f1b1-4753-4b91-b5d6-d42bde84cdb1.png)
/locales
folder has an extension type other than.json
Invalid submission: File too large
This error appears if a localization file is larger than the declared limit
![Screen Shot 2022-02-03 at 11 11 15 AM](https://user-images.githubusercontent.com/3000613/152387021-c68c1683-995f-4c50-b303-2d604be21ae5.png)
Invalid submission: File empty
This error appears if a localization file is completely empty
![Screen Shot 2022-02-07 at 4 25 24 PM](https://user-images.githubusercontent.com/3000613/152874570-8f4b85d6-df07-44fc-b9c6-c1562c2330fa.png)
Invalid submission: Sum of all file sizes too large
This error appears if the combined total size of all localization files exceeds the declared limit
![Screen Shot 2022-02-03 at 11 13 06 AM](https://user-images.githubusercontent.com/3000613/152387144-7f1c3508-7121-4da5-9133-5e0909b1f0fc.png)
Invalid submission: No default / too many defaults
This error appears if none of the provided locale files are declared as the default locale, or if more than one of them are.
![Screen Shot 2022-02-03 at 11 14 01 AM](https://user-images.githubusercontent.com/3000613/152387246-17c78dd5-1af5-4a69-b08f-c532d87a2aa2.png)
How to test your changes?
CheckoutUiExtension
extension project setup.locales
directory at the root of the created extension project of type Checkout Extension.default
, e.g.en.default.json
andfr.json
shopify extension push
command.Various simple validations exist, which can be tested by playing around with the filenames under
locales
and their content. Refer to the screenshots provided above.Update checklist