Skip to content
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

Added an internationalization sample app #94

Closed
wants to merge 6 commits into from
Closed

Conversation

hainsdominic
Copy link

Why

We want to provide an example of i18n both here and on the Functions docs. This provides a way to localize the messages/display test in the Function depending on the buyers language.

How

I chose to use to [rust-i18n](https://crates.io/crates/rust-i18n) crate because it is popular and actively maintained. Similarly to the ruby-i18n gem, you store the translations in a YAML file, and these translations are loaded at runtime depending on a locale. In our case, the locale is obtained via the input query.

What should the reviewer focus on

The extensions/volume part is the only part that differs from the tutorial.

@jianghong
Copy link
Contributor

Should this be a completely different app? Or should we just augment and improve the existing one

@hainsdominic
Copy link
Author

I think the other app should stay identical to the tutorial, so 3p and 1p can refer to it without surprises.

@andrewhassan
Copy link
Contributor

There's also this sample app. Should we update/reuse that?

@andrewhassan
Copy link
Contributor

It looks like this is demonstrating how we can do i18n inside a Rust function. Given that most of this is the app boilerplate, which is unrelated to i18n in the function, should we just add a function example here?

@hainsdominic
Copy link
Author

It looks like this is demonstrating how we can do i18n inside a Rust function. Given that most of this is the app boilerplate, which is unrelated to i18n in the function, should we just add a function example here?

Makes sense. I'll move the extension code to /discounts/rust/order-discounts/volume-discount-i18n if that makes sense.

@DuncanUszkay1
Copy link
Contributor

I think this is one folder too high, it should be put into one of the API folders (product_discounts/order_discounts/shipping_discounts)

@@ -0,0 +1,21 @@
# Shopify Function development with Rust
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we start updating this READMEs with information about the function example? I think adding a description here would be useful for partners looking at this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm- is this examples repository intended to be browsed? 🤔

There's a lot of misc stuff in here, notably functions for unreleased APIs. I think there might be a fair amount of work involved in polishing this to be a good source of truth.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that since it's public, and we have a set of examples here, that partners might take a look at it. If that's not the case, then ignore my comment 😄

}
}
discountNode {
metafield(namespace: "discounts-tutorial", key: "volume-config") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be reusing the discounts-tutorial namespace or should we have unique namespaces per example?

@hainsdominic
Copy link
Author

hainsdominic commented Oct 20, 2022

Should this be closed? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants