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

Flatpickr only use language and not locale #7972

Conversation

jibees
Copy link
Contributor

@jibees jibees commented Jul 23, 2021

What? Why?

Flatpickr can be configured by passing a locale but it's more only a language than a locale.
Create and use a small attribute onto I18n javascript object.

Closes #7928

What should we test?

  1. Set up a locale like fr_CA
  2. Login as admin and choose French on the homepage
  3. Visit admin/orders/bulk_management
  4. Open the console and notice there is no error, and the date(time)picker is well configured in fr language

Release notes

Use the right language for date(time)picker when configured locale contains also country

Changelog Category: User facing changes

@jibees jibees self-assigned this Jul 23, 2021
@codecov
Copy link

codecov bot commented Jul 23, 2021

Codecov Report

Merging #7972 (6d04c99) into master (c9159a3) will decrease coverage by 70.13%.
The diff coverage is n/a.

❗ Current head 6d04c99 differs from pull request most recent head f39cc49. Consider uploading reports for the commit f39cc49 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #7972       +/-   ##
===========================================
- Coverage   93.27%   23.13%   -70.14%     
===========================================
  Files         640      568       -72     
  Lines       18152    20869     +2717     
===========================================
- Hits        16931     4829    -12102     
- Misses       1221    16040    +14819     
Impacted Files Coverage Δ
app/jobs/job_logger.rb 0.00% <0.00%> (-100.00%) ⬇️
app/jobs/heartbeat_job.rb 0.00% <0.00%> (-100.00%) ⬇️
app/services/unit_price.rb 0.00% <0.00%> (-100.00%) ⬇️
app/models/order_balance.rb 0.00% <0.00%> (-100.00%) ⬇️
app/helpers/mailer_helper.rb 0.00% <0.00%> (-100.00%) ⬇️
app/jobs/bulk_invoice_job.rb 0.00% <0.00%> (-100.00%) ⬇️
app/services/cap_quantity.rb 0.00% <0.00%> (-100.00%) ⬇️
app/services/cart_service.rb 0.00% <0.00%> (-100.00%) ⬇️
app/services/order_syncer.rb 0.00% <0.00%> (-100.00%) ⬇️
app/models/coordinator_fee.rb 0.00% <0.00%> (-100.00%) ⬇️
... and 563 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9159a3...f39cc49. Read the comment docs.

 - if "fr": return "fr"
 - if "fr_FR": return "fr"
@jibees jibees force-pushed the #7928-transform-locale-for-flatpickr branch from 88a378e to f39cc49 Compare July 23, 2021 12:14
@jibees jibees marked this pull request as ready for review July 23, 2021 12:16
@jibees jibees requested a review from Matt-Yorkley July 23, 2021 12:16
Copy link
Contributor

@Matt-Yorkley Matt-Yorkley left a comment

Choose a reason for hiding this comment

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

👌

@filipefurtad0 filipefurtad0 self-assigned this Jul 26, 2021
@filipefurtad0 filipefurtad0 added pr-staged-uk staging.openfoodnetwork.org.uk pr-staged-fr staging.coopcircuits.fr and removed pr-staged-uk staging.openfoodnetwork.org.uk labels Jul 26, 2021
@filipefurtad0
Copy link
Contributor

Hey @jibees ,
Nice!

Before - console errors; translation on the date-time-picker is broken (for fr_CA):

image

After - no console errors; translation on the date-picker is working!

image

Checked the following pages:

  • bulk order management (above)
  • orders page
  • (some) reports

Also staged and tested in servers in which the locale is fr (regression test):

  • checked the same pages as above - all good 👍

Awesome - ready to go 🎉

@filipefurtad0 filipefurtad0 removed the pr-staged-fr staging.coopcircuits.fr label Jul 26, 2021
@Matt-Yorkley Matt-Yorkley merged commit c00ca35 into openfoodfoundation:master Jul 26, 2021
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.

flatpickr not accepting locales like fr_CA or de_DE
4 participants