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

App example using webpack: Make it more interactive #489

Open
rxaviers opened this issue Aug 25, 2015 · 7 comments
Open

App example using webpack: Make it more interactive #489

rxaviers opened this issue Aug 25, 2015 · 7 comments

Comments

@rxaviers
Copy link
Member

Allow user to change number, currency, and the number of remaining tasks for the pluralization example.

This issue has been motivated by @sompylasar comment:

Maybe for the demo purposes also increment the count from 0 to some number and back to 0? This would demonstrate how plurals work with different values.

@sotojuan
Copy link
Contributor

Been working on this, it's not super pretty but it works.

I'm taking a look at the style guide now, but if this looks good I can submit the PR.

@sotojuan
Copy link
Contributor

Update: I moved the inputs to the table and added relative time and date format:

Let me know how this looks!

@rxaviers
Copy link
Member Author

@sotojuan this is looking great. Although, note the following.

When we change the formatter value only (e.g., changing the number in the first example), we use the same formatter to format various values, which is great. When we change the formatter options (e.g., changing the currency code, date pattern, or relative time unit), we are actually using different formatters, not reusing a formatter, which has its consequences: while it works just fine in development mode, where you can generate any formatter, it won't work in production mode, where it's expected that the formatter be compiled and available.

To make long story short, make dynamic the formatter values only, i.e.:

  • number: it's ok.
  • currency: the currency value 69900 (not the currency code).
  • date: the date (not the format).
  • relative time: the number of weeks (not the unit).

Does it sound good?

Thanks so far!

PS: Note you can make the relative time or patterns dynamic, but that would require a code analogous to #481 (comment).

@sotojuan
Copy link
Contributor

Gotcha, I made the following changes:

  • Currency input now changes the value
  • Date input changes the date
  • Relative time increases the seconds by the given input. Can enter negative numbers to decrease.

Let me know how this looks! I just need to handle bad inputs, add some comments, and look at the style guide again.

@rxaviers
Copy link
Member Author

@sotojuan sorry for my delayed answer, it looks better. From the picture above, I read Change format, but I guess it's only a matter of updating the button title to Change date right?

@sotojuan
Copy link
Contributor

Yep, thanks for catching that. I'm a bit busy now but later I will clean it up and follow the style guide and submit a PR. Thanks!

@rxaviers
Copy link
Member Author

Excellent. Looking forward to it and thanks.

ashensis pushed a commit to ashensis/globalize that referenced this issue Mar 17, 2016
Added uniq to with_translations to prevent duplicates when fallbacks are defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants