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

QA item: use site locale for price range as default #949

Merged
merged 4 commits into from
Sep 14, 2021

Conversation

yen-tt
Copy link
Contributor

@yen-tt yen-tt commented Sep 13, 2021

  • update priceRange formatter function to determined the price range string in following order:
    • use provided country code to determine the currency symbol
    • if country code is invalid or undefined, use site locale to determine the currency symbol
    • if all else fails, return the default price range, which is in $

TEST=auto

add more cases in jest test, all passed

- update priceRange formatter function to determined the price range string in following order:
	- use provided country code to determine the currency symbol
	- if country code is invalid or undefined, use site locale to determine the currency symbol
	- if all else fails, return the default price range, which is in $

TEST=auto

add more cases in jest test, all passed
@coveralls
Copy link

coveralls commented Sep 13, 2021

Coverage Status

Coverage increased (+0.06%) to 8.61% when pulling 60c2169 on dev/currency-formatter-QA into 13a5928 on develop.

if (currencySymbol) {
return defaultPriceRange.replace(/\$/g, currencySymbol);
}
}
console.warn(`Unable to determine currency symbol from ISO country code ${countryCode}.`);
const { region, language } = parseLocale(_getDocumentLocale());
Copy link
Contributor

@oshi97 oshi97 Sep 13, 2021

Choose a reason for hiding this comment

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

does getDocumentLocale need to be updated to use parseLocale?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's fine to keep it as is since there are multiple locations that invoke this method to get the locale as a single string as is. If there's a place, like in priceRange, that requires some parsing then they can use parseLocale to get each sections.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok sounds like the other formatters are ok with chinese!

@yen-tt yen-tt requested a review from oshi97 September 13, 2021 21:17
@yen-tt yen-tt merged commit 72e3c0f into develop Sep 14, 2021
@yen-tt yen-tt deleted the dev/currency-formatter-QA branch September 14, 2021 14:31
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.

4 participants